D
Could you give a an advice how to insert keys/index to a an array in a specific order
as you can se…. I would like to in the result index the values id1 = 3 id2 = 4 id3 = 5.
How do I do that?
This code
public static function getTest($ids){
$input = array();
foreach ($ids as $id) {
$input['result'] = $ids;
}
$result = array('status'=>"success",
'message'=>"blah blah",
'result'=> $ids
);
var_dump($result);
return $result;
}
produces this (getTest is called from another file and it gives out array(3,4,5))
array(3) {
["status"]=> string(7) "success"
["message"]=> string(9) "blah blah"
["result"]=> array(3) {
[0]=> int(3)
[1]=> int(4)
[2]=> int(5)
}
}
If you create an array the elements are in the order you added them:
I am not really sure what you want but have a look here the page always helps my lot.
Response to comment:
Try this