Today I run across this strange PHP behaviour. Say, you need to build an associative array from an array. For a task like that, I wrote this:
$idx=0;
foreach($planets as $planet)
$results[$idx++] = $planet;
Guess what? It won’t work. $result is built as a normal array, not associative. And it could be reasonable, after all… but:
$idx=0;
foreach($planets as $planet)
{
$idx++;
$results[$idx] = $planet;
}
Note the increment of $idx wrapped out from the square brackets. Well, after the loop, $result is a shiny new associative array. Ah!
RSS







Ajax or not Ajax
What is really wondering me is not the technology behind the name, but is how the name itself (a contraction for Asynchronous data retrieval and JavaScript/Ecmascript) became so popular in a so short time. It was about a month ago that it has been introduced, by a (now famous) J.J. Garret article. In the meantime, looking at this glorious spreading, there has been also someone who did not accepted it as-is, as many did (myself being one of them: I do like the name, and I think that a stack like this should have a name for the love of all the nerds out there).
So, here are the contenders:
By the way, J. J. Garret is also the inventor of the Visual Vocabulary aka the Garrett Diagrams. They are shipped with Mac OSX OmniGraffle as the Garrett IA shapes.