Evaluate PHP objectively, fairly, and without prejudice, its advantages and disadvantages, comparison with other languages, and everything else. Do not simply say "PHP is the best language" and "PHP is the worst language. Evaluate PHP objectively, fairly, and without prejudice, its advantages and disadvantages, comparison with other languages, and everything else.
Do not simply say "PHP is the best language" and "PHP is the worst language. Reply content: as a C language, I have been developing a habit of being sensitive to data types until I use php. how can I define variables like a joke. You are already preemptively denying that "PHP is the best language". what else is objective and fair?
In fact, PHP is the best WEB development language (none), unless you think that 80% of website developers are silly.
Although many people persistently spray PHP, the rapid increase in market share of PHP is still a resounding slap in the face.
The advantages and disadvantages of PHP are also discussed on the Internet.
As a WEB development language, the main advantages are:
1. fast development speed, seckilling all other web development languages
2. deployment and maintenance are extremely simple. Second-kill all others
3. good performance, better than Python and Ruby. Not as good as JAVA, but the gap is acceptable.
The rest is no longer important.
PHP is the most popular language feature, but the language is used to implement the function, not at the academic research level. it is the king to achieve a good practical effect.
You have designed a language with perfect features, but it is extremely difficult to learn and use. I have worked on php development for a few years, and later I have worked on c # and java development for a short time. I have also come into contact with some other languages, including ruby and python. Currently, I am focusing on web front-end development. Therefore, I think I can evaluate php fairly and objectively.
Advantages
In the web field, php is indeed an out-of-the-box language.
Web development environmentIs very convenient, especially
Beginner. A demo can be quickly written according to the example. it is very convenient and simple, and requires no OO, no additional template engine. If you need additional libraries, add the files directly to the directory and use include or require. This is undoubtedly the most convenient for new users or micro-projects. Four words: out-of-the-box.
For developing large projects, OO, template engine, package manager, and various frameworks are also available. It can be said that php can also meet enterprise-level development needs.
Many people have previously criticized the shortcomings of php, including
- No good Package Manager (pear, but not many)
- Lack of namespace
- Nonstandard development
At present, some of the above shortcomings have been solved.
- ComposerWidely used php package manager
- 5.3 and later added support for namespaces
- PHP pathSome restrictions on php development
Disadvantages
Performance problems, which is indeed inferior to java, but php NG has greatly improved its performance.
Function naming and parameter order are not standardized and disordered. I wrote php code for several years and expressed my opinion.
Compared with other languages, Php has the advantages of being simple and rude, being easy to handle, and being cheap for migrant workers.
However, these advantages are at the cost of robustness, maintainability, and scalability.
Weak php types and real-time compilation lead to many errors that can be found during running. Therefore, systems with high robustness requirements will not be built using languages like php, which banking system did you see written in php?
Php has not worked hard on code specifications, resulting in mixing of various php code writing methods. What makes it hard to maintain the support of others' code is...
Let's talk about the php architecture. php adopts the script + extension 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, this makes porting much more complicated. From this point, php is an assembler. From the perspective of the language design goal, it is mainly for the web. this can be said that php is widely used, and it is also the reason for complaints. I will compare php and java in the following three aspects:
1. network programming
Php can be well integrated with the server, so it is freed from socket programming. Unlike other common java/python web programming languages, you usually need to implement the server by yourself, moreover, php encapsulates the global variables required by http through sapi, which greatly simplifies manual parsing of http protocol, however, on the other hand, php's support for socket, multiplexing, and other network programming is obviously weaker than java.
2. Concurrent Programming
Php does not provide good concurrent programming methods, which is not a big problem when serving the server. However, it hurts to write an independent client or server program. This greatly limits php to become a better language than java.
3. syntax features
In terms of syntax, php and java are very similar, but they also have their own characteristics and are also making progress. For example, java supports fanlike programming, php supports anonymous functions, closures, and so on (java 8 is available), and php introduces new features such as scalar type under the influence of hack.
To sum up, php is not friendly in terms of network programming and concurrent programming. it should be improved in the future of php 7. it has unique advantages for web Programming php, but there is still a long way to become a more general language.