How to evaluate the PHP language objectively and impartially?

Source: Internet
Author: User
Evaluate PHP objectively, impartially and unbiased, its pros, cons, comparisons with other languages, and everything else.
Don't simply say "PHP is the best language" and "PHP is the worst language".

Reply content:

As a C language Foundation, has been developed to the data type is very sensitive to the habit, until the use of PHP. I drop a god, define the variable how and joke. Have you already made a firm denial that PHP is the best language and what is objective and impartial?
In fact, PHP is the best web development language (not one) unless you think 80% of Web developers are dumb x.


Although a lot of people continue to spray PHP, but PHP with the rapid rise in market share also with a loud slap.

The advantages and disadvantages of PHP, online discussion is also a lot.
As a Web development language, the main advantages are:
1. Fast development, seconds kill all other web development languages
2. Deployment, maintenance is extremely simple, another second to kill all other
3. Good performance, better than Python, Ruby. Not as Java, but the gap is acceptable.

With these points, the others are no longer important.

PHP is the most sprayed language features, but the language is used to achieve the function, not stay in the academic research level, the actual effect is benevolent.
You design a language with perfect features, but it's extremely difficult to learn, and there's no egg to use. A few years of PHP development, and then a short time to do C#,java development, but also exposed to some other languages, including Ruby and Python, currently focused on web front-end development. So I think I can still be more impartial and objective evaluation of PHP.

Advantages
In the Web, PHP is really a language that can be used out of the box, whether under Linux or Windows, to build Web Development Environmentare very convenient, especially for NoviceFor A demo can be written quickly as an example, which is very convenient and simple, no OO required, no additional template engine required. If you need additional libraries, add the files directly to the directory, and use the include or require to come in. This is undoubtedly the most convenient for new or developing micro projects. Four words: Out of the box.

The development of large-scale projects, OO, template engine, Package Manager, all kinds of frameworks are also everything. It can be said that PHP is also able to meet enterprise-level development needs.

Many of the drawbacks of PHP that were previously criticized include
    1. No good Package Manager (pear, just not much)
    2. Lack of namespaces
    3. Development of non-standard
At present, some of these shortcomings have been resolved
    1. Composer currently uses a wide range of PHP package managers
    2. Added support for namespaces after 5.3
    3. PHP's Path to the development of PHP has made some normative restrictions

Disadvantages
Performance issues, which is really less than Java, but the current PHP ng performance has been greatly improved.

There is no uniform specification for function naming and parameter order, which is more chaotic. Wrote a few years of PHP code, to publish a personal view.

Compared to other languages, PHP has the obvious advantage of being simple and rude, quick to get started, and cheap for migrant workers.

But these advantages are at the expense of robustness, maintainability and extensibility.

PHP weak type, on-the-fly compilation, resulting in a lot of errors in the runtime can be found, so the robustness of the high-demand system will not be built in the language of PHP, you have seen which bank of the system is written in PHP?

PHP does not work on code specifications, resulting in a variety of PHP code to mix, the ultimate hardship is to maintain someone else's code of the tray-man ...

Besides the PHP architecture, PHP uses a script + extended architecture, you will find that many of the core code of the PHP application is implemented on the extension, and the extension is written in C, so the porting is much more complicated. From this point, PHP is an assembler. From the target of language design, mainly for the web, this can be said to be the reason for the widespread use of PHP, is also the reason for the people to spit groove. I compare the following three aspects of PHP and Java this pair of friends:
1. Network programming
PHP is well-integrated with the server, so freed from socket programming, unlike Java/python other common Web programming languages usually need to implement the server themselves, and PHP itself through SAPI encapsulates the global variables required by HTTP, This greatly simplifies the manual parsing of the HTTP protocol, but on the other hand, it also leads to PHP's support for socket, multiplexing and other network programming is significantly weaker than Java.
2. Concurrent programming
PHP does not provide good concurrency programming, which is not too much of a problem when it comes to server service, but it hurts if you write a standalone client or server program. This, in contrast to Java, greatly restricts PHP to become a better language.
3. Grammatical characteristics
In terms of syntax, PHP is much like Java, but it has its own characteristics and progress. For example, Java support for Paradigm Programming, PHP support for anonymous functions, closures, etc. (JAVA8), PHP has introduced new features such as scalar types under the influence of hack.

Comprehensive: PHP in the network programming and concurrent programming is not friendly, after PHP7 should be improved, for the Web programming PHP has a unique advantage, but to become a more general language, there is a longer way.
  • 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.