This page show the bigs diferences: PHP in contrast to Perl:
in reply to Re^2: The REAL reason for why they choose PHP over Perl.
in thread The REAL reason for why they choose PHP over Perl.
but PHP5 is more OOP.
- Arguments and return values are extremely inconsistent
- PHP has separate functions for case insensitive operations
- PHP has inconsistent function naming
- PHP has no lexical scope
- PHP has too many functions in the core
- PHP lacks abstraction and takes TIMTOWTDI to bad extremes
I suppose the best reason are these:
Humm... Some points are debatables, of course.
- PHP is built from the ground-up with database functionality built in, particularly MySQL functionality. Perl is not.
- PHP code gets embedded into HTML pages, unlike Perl. This makes it very fast to code web pages and fast to deploy a new site, thus speeding up Web development and lowering overall cost of ownership. An important code management technique for programmers is separating code from data. This allows us to make changes to the code or data without affecting the other. PHP uses the tags to indicate "code inside". In Perl, however, programmers are encouraged to use print statements to generate the HTML. True it is possible to implement templates in Perl (with more difficulty than in PHP) to separate code and HTML, but 90% of sample Perl code on the web doesn't do that.
- PHP is secure. Perl scripts tend to have more security holes. This is because PHP has built-in a lot of the internal operations of dealing with web page requests and serving information.
- PHP is easy to learn in comparison to Perl. It's easier to learn than C, Python, Java, and most other programming languages used in web development, for that matter. The Perl style of programming is unique, and thus not universally applicable to or from other programming languages. Accessing web form variables in PHP is straightforward, but in Perl requires either detailed knowledge of either HTTP header formats or one of many Perl CGI libraries.
- PHP takes less "overhead" than Perl, meaning that PHP scripts will run faster than CGI scripts written in Perl, and you'll be able to handle more simultaneous users on your site. Benchmarking tests show time and again that PHP runs faster than other web programming languages. Check out these benchmarking analyses done by major computing magazines.
- PHP code tends to be more consistent and modular than Perl.