3 ms·
They are ordered by insertion. That's different from for instance objects in Javascript.
by wlievens 15y ago
They are ordered by insertion. That's different from for instance objects in Javascript.
- rorrr 15y agoNot really $arr = array(); $arr[0] = 'cat'; $arr[2] = 'dog'; $arr[1] = 'fish'; krsort($arr); var_dump($arr); Outputs: array(3) { [2]=> string(3) "dog" [1]=> string(4) "fish" [0]=> string(3) "cat" }
- josegonzalez 15y agoWell you are explicitly sorting the array by keys, so its not like you are contradicting his sentence. Remove the krsort() call and your "not really" becomes "example".