Perl vs PHP
From WikiVS, the open comparison website
| Perl | PHP | |
|---|---|---|
| VS
|
|
| http://www.perl.org | http://www.php.net |
Contents |
[edit] Arrays
Referencing the last element of an array:
- Perl:
$array[-1]
- PHP:
end($array)
[edit] Performance
[edit] Gotchas
PHP suffers from magic quotes.
[edit] Namespace separator
The PHP team decided that the namespace separator is going to be the backslash character. This has drawn protests from the community.
[edit] Code base
PHP's codebase has developed in a somewhat haphazard fashion, with various developer teams piling up PHP code. As a consequence, random oddities can be found in the core, for example foreign token names. Compiling the code below,
<?php foreach($x as key) ?>
produces the following message:
Parse error: syntax error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM
Note that T_PAAMAYIM_NEKUDOTAYIM is an official PHP token, listed at http://php.net/tokens, and has a Wikipedia entry.
[edit] Web application development
Perl's flagship web application framework is Catalyst.
PHP has various competing web application frameworks.
[edit] Rants
I used to cut PHP programmers some slack... newbies have to start somewhere, said I... After this past week... I am firmly of the opinion, if you can't quite grok a real language, maybe you shouldn't be programming. I've written semi-decent code in PHP... When PHP was required, but nothing else was required. Problem seems to be that php programmers are pathologically broken-headed. They hear of things like 'frameworks' and 'MVC' and they read half of the wikipedia page and go write something that is almost entirely, but not quite, unlike a framework / MVC. I mean... seriously. what's the point of an MVC framework if you have to write all the M functions yourself, manually include them into each 'action' and then manually load a view class and call the view. It's the 'bring lots of wood so you can build your own ladder' framework.
— Jay Kuri, CPAN contributor (after a particularly bad php project)


del.icio.us
digg
Facebook
Furl
reddit
Slashdot
Twitter