I've been working on PHP applications for the last four years. PHP is really easy to write. But PHP also has some very serious flaws.
Below I will give my reasons why PHP is not suitable for larger sites than small amateur websites.
1. Bad support for recursion
Recursion is the mechanism by which a function calls itself. This is a powerful feature that makes it easy to make something complex. One example that uses recursion is the quick sort (quicksort). Unfortunately, PHP is not good at recursion. Zeev, a PHP developer, said: "PHP 4.0 (Zend) uses a stack for dense data, rather than a heap approach." That is, the number of recursive functions that it can tolerate is significantly less than in other languages. "See Bug 1901. This is a very bad excuse. Each programming language should provide good recursive support.
2. Many PHP modules are not thread-safe
A few years ago, Apache released version 2.0 of the Web server. This version supports multithreaded mode, in which one part of the software can run multiple at the same time. PHP's inventors say the core of PHP is thread-safe, but Non-core modules are not necessarily. But 10 times nine times, you want to use this module in your PHP script, but that makes your script unsuitable for Apache multithreaded mode. This is why the PHP team does not recommend running PHP in the multi-threaded mode of Apache 2. Poor multithreaded mode support makes PHP often considered one of the reasons why Apache 2 is still not popular.
3. PHP is not sound due to business reasons
By using caching, PHP's performance can be spiked 500%[see benchmark. So why is caching not built in PHP? Because the zend--php maker, it's selling its own Zend accelerator, so of course, they don't want to throw away their commercial products.
But there's another alternative: APC. (Zend later launched Zend Optimizer, free accelerator--translator)
4. No namespaces
Imagine a person making a PHP module to read a file. A function in a module is called read. Then another person's module can read the page and also contains a function read. Then we can't use these two modules at the same time, because PHP doesn't know which function you want to use. But there is a very simple solution, that is the namespace. It has been suggested that PHP5 should join this feature, but unfortunately he did not. Now, without namespaces, each function must prefix the module name to avoid name collisions. This causes the function name to be horrible, such as Xsl_xsltprocessor_transform_to_xml, which makes the code difficult to write and understand.
5. Non-standard date format characters
Many programmers are familiar with date format characters, from UNIX and C languages. Some other programming languages adopt this standard, but oddly enough, PHP has its own set of completely incompatible date format characters. In C, "%j" means the day of the year, in PHP he says the day of one months. What makes things even more confusing: the strftime functions and Date_format functions of Smarty, a popular PHP template engine, use C/unix formatting characters.
6. Chaotic License
You might think PHP is free, and all the PHP modules mentioned in the manual are free. Wrong! For example, if you want to generate PDF files in PHP, you will find two modules in the manual: PDF and ClibPDF. But both of these are commercially licensed. So, every module you use, you have to make sure that you agree with his license.
7. Inconsistent function naming rules
Some function names are made up of multiple words. There are generally three kinds of words in the habit of combination:
Direct stitching: Getnumberoffiles
Separate by underline: Get_number_of_files
Camel rule: Getnumberoffiles
Most languages choose one of them. But PHP is used.
For example, if you want to convert some special characters into HTML entities, you will use the function htmlentities (directly stitching words). If you want to use the opposite function, you need to use its penis html_entity_decode. For some special reasons, this function name is a separate word from the underscore. How can this be? You know there's a function called Strpad. Or is he str_pad? Every time you have to check out what the symbol is or just wait for him to make a mistake. Functions are case-insensitive, so there is no difference between Rawurldecode and Rawurldecode for PHP. This is also bad because two of them are used and they look different, confusing the reader.
8. Magic references to Hell
The Magic Reference (Magic quote) protects the PHP script from SQL injection attacks. This is good. But for some reason, you can turn this configuration off in php.ini. So if you want to write a flexible script, you always have to check that the Magic reference is turned on or off. Such an "attribute" should make programming simpler, and in fact more complex.
9. Lack of a standard framework
A growing web site has no overall framework and will eventually become a maintenance nightmare. A framework can make a lot of work easier. Now the most popular framework model when mvc-model, in which the presentation layer, business logic and database access are separated.
Many PHP sites do not use the mvc-model. They don't even have a frame. Even now there are some PHP frameworks you can write yourself, and the articles and manuals about PHP do not improve the framework of a word. At the same time, jsp-developers use a framework like struts, and ASP developers use. Net, and it looks as if these concepts are widely understood by PHP developers. This shows how much of a professional PHP actually is.
Summarize
What's the problem?
For very small projects, it can be a very satisfying programming language. But for larger and more complex projects, PHP is showing weakness. As you continue to grope, you will find solutions to some of the problems I have mentioned. So, when the solution is known, why can't you fix it? And why aren't these fixes mentioned in the manual? The popularity of an open source language is a good thing. But unfortunately, it's not a great language. I hope that all the problems can be solved one day (perhaps in PHP6), and then we will have an open source language, he is open source, and easy to use.
By now, when you start a project with more than 5 script pages, you'd better consider c#/asp.net or java/jsp or maybe Python is also a better choice.