ios - how to swap php variable characters around -
ios - how to swap php variable characters around -
i trying utilize formula requires me mix characters of variable around. new php , confused lack of format specifications in other languages.
the php script beingness passed/(post) 2 objective-c integers app, here php code have far, pretty simple more of proof of concept , figuring out if variable coming script still int or string or whatever heck might be.. confused php , lack of having declare format specifications etc.
<?php $inputdate = $_request['userdate']; //example of whats coming in 12345678 //swap 4 characters around //23416587 (this not random) //then send result ?> so, first question be, when $inputdate instantiated '12345678' integer? or can still perform string manipulation mix numbers have shown above?
the original value of $_request['userdate']; string. safe, cast (string)$_request['userdate'] or append empty string. order desire, do:
$inputdate = (string)$_request['userdate']; //12345678 23416587 $formatted_date = $inputdate[1].$inputdate[2].$inputdate[3]. $inputdate[0].$inputdate[5].$inputdate[4]. $inputdate[7].$inputdate[6]; //use (int) or intval() if need integer first //then send app since new php, allow me var_dump , error reporting friends:
<?php ini_set('display_errors', 'on'); error_reporting(e_all); php ios int
Comments
Post a Comment