Nine reasons why PHP is helpless for large websites are that PHP is very easy to write. However, PHP also has some very serious defects. Next I will give my reasons why PHP is not suitable for websites larger than small and amateur websites. 1. poor support for recursion is a function calling mechanism. This is a powerful feature that can make some complicated things very simple. A recursive example is quick sort ). Unfortunately, PHP is not good at recursive use of PHP as nine helpless reasons for large websites
PHP is indeed very easy to write. However, PHP also has some very serious defects. Next I will give my reasons why PHP is not suitable for websites larger than small and amateur websites.
1. poor support for recursion
Recursion is a function calling mechanism. This is a powerful feature that can make some complicated things very simple. A recursive example is quick sort ). Unfortunately, PHP is not good at recursion. Zeev, a PHP developer, said: "PHP? 4.0 (Zend) uses the stack instead of the heap method for intensive data. That is to say, the number of recursive functions that it can tolerate is significantly less than that of other languages ." See bug? 1901. This is a bad excuse. Every programming language should provide good recursive support.
2. many PHP modules are not thread-safe
A few years ago, Apache released the Web server version 2.0. This version supports multi-threaded mode. In this mode, one part of the software can run multiple at the same time. The inventor of PHP said that the core of PHP is thread-safe, but not necessarily non-core modules. But nine times in ten times, you want to use this module in the PHP script, but this makes your script not suitable for the Apache multithreading mode. This is why the PHP team does not recommend Apache? 2? Run PHP in multi-threaded mode. Poor multi-thread mode support makes PHP often considered Apache? 2. one of the reasons why it is still not popular.
3. PHP? Not perfect for commercial reasons
By using the cache, PHP performance can increase by 500% [see the benchmark test]. Why is the cache not built in PHP? Because Zend -- the maker of PHP, is it selling its own Zend? Accelerator, so of course they don't want to abandon their commercial products.
But there is another option :? APC .? (Zend was launched later? Optimizer, a free accelerator-translator)
4. no namespace
Imagine a person created a PHP module to read files. A function in the module is called read. Then another module can read the webpage, which 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 simple solution, that is, namespace. Someone suggested that PHP5 add this feature, but unfortunately he didn't. Currently, there is no namespace. each function must be prefixed with a module name to avoid name conflict. This causes the function name to be too long. for example, javas_javastprocessor_transform_to_xml makes the code difficult to write and understand.
5. non-standard date format characters
Many programmers? Date format character? Are familiar with, it comes from UNIX and C language. Some other programming languages use this standard, but it is strange that PHP has its own set of completely incompatible date format characters. In C, "% j" indicates the day of the year, and in PHP, it indicates the day of the month. But what makes things even more messy is: Smarty? (A popular PHP template cited? Strftime? Functions and? Date_format? Function, but uses C/UNIX formatted characters.
6. chaotic licenses
You may think PHP is free, and all the PHP modules mentioned in the manual are free. Wrong! For example, if you want to generate a PDF file in PHP, you will find two modules in the manual: PDF? And? ClibPDF. However, both of them have commercial licenses. Therefore, you must ensure that you agree to his license for every module you use.
7. inconsistent function naming rules
Some function names are composed of multiple words. There are three kinds of word combinations:
Splicing: getnumberoffiles
Separate by underline: get_number_of_files
Camel rule: getNumberOfFiles
Select one of most languages. But PHP is used.
8. magic references to hell
Magic reference (Magic? Quote) can protect PHP scripts from SQL injection attacks. This is good. But for some reason, you can disable this configuration in php. ini. Therefore, if you want to write an elastic script, you always need to check whether the magic reference is enabled or disabled. Such a "feature" should make programming easier, but in fact it becomes more complicated.
9. lack of standard framework
A growing website does not have an overall framework and will eventually become a nightmare of maintenance. A framework can simplify a lot of work. Currently, the most popular framework model is the MVC-model, in which the presentation layer, business logic, and database access are all separated.
Many PHP websites do not use the MVC-model. They don't even have a framework. Even now, you can write some PHP frameworks on your own. The articles and manuals on PHP have not improved the framework. Meanwhile, JSP-developers use the framework like Struts and ASP developers use. net. it seems that these concepts are widely understood by PHP developers. This shows how professional PHP is.
Summary
For very small projects, it can be a very human-intended programming language. But for larger and more complex projects, PHP shows that it is weak. After you keep exploring, you will find the solutions to some of the problems I mentioned. So when the solution is known, why can't we fix it? In addition, why are these patches not mentioned in the manual ?? It is a good thing that an open-source language is very popular. More detailsProgramming language tutorial setYou can log on to e Liangshi Yiyou.