I was writing something up real quick in PHP this weekend and got tripped up on an error in syntax. It was simple really, just a confusion between PHP and Perl - my programming languages of choice. Take for example the way PHP implements the foreach construct.
foreach (@array as $element) {
But what I used was the Perl foreach construct - which is subtly different.
foreach $element (@array) {
Took me a little bit to catch that. Good ole $php -l eventually pointed out my clerical error. You would think that PHP would take a little more guidance from Perl; being that Perl is about 8 years older.
[1] http://en.wikipedia.org/wiki/Perl
[2] http://en.wikipedia.org/wiki/PHP

Leave Your Comments Below