The similarities and differences between Perl and PHP

Source: Internet
Author: User

According to personal experience, do not say the good and bad of both, just say the similarities and differences between the two.

1, variable name

There are three definitions of Perl variable names, beginning with $,%, and @, representing general variables, hash variables, and array variables, respectively. PHP, for all the variables to be unified with the $ beginning, this, PHP seems to be more concise. And the hash array of PHP itself is already ordered, and Perl is not


2, the amount of basic functions

Perl's basic function is very few, compared with C, from this point of view, the individual think that Perl to a higher level, some system. PHP has a lot of functions.


3, the expansion of the size of the module

Perl has a lot of extension modules, almost everything, so Perl is almost omnipotent, and CPAN is the base of the Perl expansion module. PHP's set of extension modules, called pear, also has many modules, but less than CPAN.


4. Object-oriented ability

The object of Perl is implemented using modules, and it doesn't feel like oo in real sense, it's just a function and variable wrapper in the general sense. PHP4 is also generally so. After PHP5, the object-oriented feature has improved dramatically, with almost all of the OO features, even though it's not as object-oriented as Java.


5. Cross-platform capability

Both are cross-platform, but Perl tends to be linux/unix, with ActivePerl on Windows, and Mod_perl as if only with Apache (no attempt to combine IIS and Mod_perl, so it's not very clear). PHP to take into account a variety of environments, Windows above performance and Linux/unix almost the same, with Apache/iis can also be free to combine, this point, it should be said that PHP has done very well, you can do random collocation.


Let's talk about these points first, then add

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.