People irk me when they expect PHP to behave like <insert your favorite language here>. Most recently, I ran across this blog entry Perl vs PHP: Variable Scoping via the help of PHPDeveloper.org. I'm sure Leonid is a great fellow and really smart... but he just happened to trip my irk-wire.
The post is an innocent enough "here's a problem that I ran into, so I'll blog it in case someone else has the same issue." Reading between the lines though, I get the feeling his underlying belief is that because PHP and Perl are similar that they should have the same variable scoping rules, and that since PHP's doesn't correspond to Perl's that PHP is wrong and this should be documented as such.
Each language is different. If PHP were so similar to Perl, it wouldn't be called PHP... it'd be called Perl. Or maybe a dialect, like PHPerl. I really wish people would stop comparing the two. Quite frankly, I don't see much similarity between the two languages at all.
Maybe I can get away with saying PHP and Lisp are similar because I can do the same thing in both languages!
The post is an innocent enough "here's a problem that I ran into, so I'll blog it in case someone else has the same issue." Reading between the lines though, I get the feeling his underlying belief is that because PHP and Perl are similar that they should have the same variable scoping rules, and that since PHP's doesn't correspond to Perl's that PHP is wrong and this should be documented as such.
Each language is different. If PHP were so similar to Perl, it wouldn't be called PHP... it'd be called Perl. Or maybe a dialect, like PHPerl. I really wish people would stop comparing the two. Quite frankly, I don't see much similarity between the two languages at all.
Maybe I can get away with saying PHP and Lisp are similar because I can do the same thing in both languages!
$a = 2 + 2 * 4; echo $a; (setq a (* (+ 2 2) 4)) aUpdate 12/20/2008: Luke Wellington wrote a brief article entitled PHP Is Not Java for the PHP Advent 2008 project. I'm glad to see I'm not the only one who gets irked by such things (though he is much more eloquent about it than I am).
mutha stepped to the wrong foo!
ReplyDeletefair enough :)
ReplyDeletePerl is the best scripting language for Text processing and handle regex. I have posted few articles related to those at my blog
ReplyDeletehttp://icfun.blogspot.com/search/label/perl
Also Perl's Cpan has lots of support that I don't even need to think extra while developing project. I didn't find such help on other programming language except Java and .NET
Wolf... the point of this post wasn't to argue which which language is better. Both have their strong points and weaknesses. Instead, I was pointing out the need to bear in mind that each programming language is different and does things its own way. We just need to be careful about misconceptions that can result from expertise in other languages.
ReplyDeleteBy the way, CPAN is a good resource for Perl hackers, but Perl isn't the only language that has a popular code repository. PHP programmers have the PEAR and PECL repositories, and Ruby programmers have RubyForge.