Some very serious defects detailed based on PHP

  • 2020-06-03 06:04:08
  • OfStack

Poor support for recursion
Recursion is a mechanism by which a function calls itself. This is a powerful feature that can take something complex and make it simple. One example of using recursion is quicksort (quicksort). Unfortunately, PHP is not very good at recursion. Zeev, an PHP developer, said: "PHP 4.0(Zend) USES a stack approach to dense data rather than a heap approach. That is, the number of recursive functions 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 its Web server. This version supports multithreading mode, in which software parts 1 can run more than one at a time. PHP's inventors say the core of PHP is thread-safe, but non-core modules are not. But nine times out of 10, you want to use this module in your PHP script, but it doesn't fit into Apache's multithreaded mode. This is also why the PHP team does not recommend running PHP in Apache 2's multithreaded mode. Poor multithreading mode support is often cited as one reason why PHP 2 is still not popular.
PHP is unsound for commercial reasons
Using caching, PHP can see a 500% jump in performance [see benchmark]. So why isn't the cache built in PHP? Because Zend, the maker of PHP, sells its own Zend Accelerator, of course, they don't want to throw away the fat of their commercial product.
But there's another option: APC.
4. No namespaces
Imagine someone creates an PHP module to read documents. One of the functions in the module is called read. Then another person's module can read the web page, also containing 1 function read. Then we won't be able to use both modules, because PHP doesn't know which function you're going to use. But there is a very simple solution, and that is namespaces. It was suggested that PHP5 include this feature, but unfortunately he did not. Now, there is no namespace, and each function must be prefixed with the module name to avoid name conflicts. This leads to dreadfully long function names, such as xsl_xsltprocessor_transform_to_XML, which make the code difficult to write and understand.
5. Non-standard date format characters
Many programmers are familiar with the date format character, which comes from the UNIX and C languages. Other programming languages adopt this standard, but curiously, PHP has its own set of completely incompatible date format characters. In C, "%j" means the day of the year, and in PHP he means the day of the month. To make things even more confusing, the strftime and date_format functions of Smarty (a popular PHP template engine) use the formatting characters of C/UNIX.
6. Messy permits
You might think that PHP is free, as are all the PHP modules mentioned in the manual. 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 are commercially licensed. So, for every module you use, you have to make sure that you agree to his license.
7. Not 1 to the function naming rules
Some function names are composed of multiple words. 1. There are three common word combinations:
Direct splicing: getnumberoffiles
Underline get_number_of_files
Camel rule: getNumberOfFiles
Most languages choose one of them. But PHP USES them all.
For example, if you want to convert a special character to an HTML entity, you would use the function htmlentities (directly splicing words). If you want to use the opposite function, you use its little brother html_entity_decode. For some special reason, the function name is separated by an underscore. How could that be? You know there's a function called strpad. Or is it str_pad? Every time you have to check 1 to see what the symbol is or wait for it to make an error. Functions are case-insensitive, so there is no difference between rawurldecode and RawUrlDecode for PHP. This is also bad because both are used and they don't look the same, confusing the reader.
8. Hell referenced by magic
Magic references (Magic quote) protect PHP scripts from SQL injection attacks. That's good. But for some reason, you can turn this configuration off in ES102en.ini. So if you want to write a flexible script, you should always check if the magic reference is on or off. Such a "feature" should make programming easier, but it actually gets more complicated.
9. Lack of a standard framework
A growing site without a framework will eventually become a maintenance nightmare. A framework can make a lot of work easier. The most popular framework model today is the 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 framework. Even now there are a few PHP frameworks and you can write one yourself, the articles and manuals on PHP do not improve the framework by one word. At the same time JSP- developers use frameworks like Struts, ASP developers, it seems as if these concepts are widely understood by PHP developers. This shows how professional PHP actually is.
What's the problem?
For very small projects, it can be a 10 point satisfactory programming language. But for larger and more complex projects, PHP showed weakness. As you explore, you will find solutions to some of the problems I mentioned. So, when the solution is known, why not fix it? And why aren't these fixes mentioned in the manual? An open source language 10 stream is a good thing. Unfortunately, it's not a great language. I hope all the problems can be solved one day (maybe on PHP6?). "And then we'll have an open source language that's both open source and easy to use.
By now, when starting a project with more than five script pages, you might want to consider C#/ ASP.NET or Java/JSP or perhaps Python as a better option as well.

Related articles: