This
Monday, April 7th, 2008The Promised Land – this is a wonderful read, a beautiful and perfect cap for a hectic day.
The Promised Land – this is a wonderful read, a beautiful and perfect cap for a hectic day.
array_reverse() doesn’t maintain array keys.
The problem here isn’t this specific behavior, but it neatly encapsulates one of my core complaints with PHP. Which is: there’s an attitude of “do something dumb, unless the developer asks not to.” You see this over and over in the PHP world. Mangling keys unless you ask not to. Magic [...]
Firefox 3.0b5: Now with 100% more crashes when getting directions with Google Maps. By which I mean it crashes every time I try to do so.
Apple to go into the operating system business?
No.
This has been another edition of simple answers to stupid questions.
Adding, Apple is already in the OS business, just not for non-Apple hardware. So my answer only makes sense if you recognize that the question is badly phrased. I leave you with this gem:
My Apple Fool’s day story [...]
Note: This function assigns new keys for the elements in array . It will remove any existing keys you may have assigned, rather than just reordering the keys.
My favorite. Here is the painfully artless workaround:
$data = array(1 => ‘a’, 2 => ‘b’, 3 => ‘c’, 4 => ‘d’);
$out = array();
$keys = array_keys($data);
shuffle($keys);
foreach ($keys as $key) [...]