I have an array, for example
$arr=array(
"foo" => "fooval",
"boo" => "booval",
"roo" => "rooval",
);
and then I want to print all elements in pattern “key is value”. This code should do the job:
foreach($arr as $key => $val)
echo $key." is ".$val;
Will I get this?
foo is fooval
boo is booval
roo is rooval
I mean the order. Is it guaranteed that it will execute in same order as the array was given, or the arrays are sorted somehow?
Thanks for any answers.
arraysare ordered list of values and thier orders do not need to be sorted. It follows a sequenceFROM PHP DOC