With the advent of the so-called WEB2.0 era, programmers have never received as much attention as they do today, and the debate among many programmers about languages has never been as fierce as it is today, such as JAVA, C++, PHP, ASP, etc. Wait, recently another Ruby came out, plus Python. Countless FANS are arguing in the middle, that is, on the Internet, if it is in real life, it will probably be like what is described in "The Legend of Heaven and Dragon Sword", where they will fight Guangmingding to determine the outcome, or determine the number one in the world. A sect. Now it is actually very convenient to determine who is the best in the world. Just look at the number of disciples under which language. The most popular statistical method now is Google. If you look at Google’s search results, you can basically judge its usage on websites on the market:
There are about 5,760,000,000 items that comply with php Query results
There are about 3,070,000,000 query results that are in line with asp
There are about 976,000,000 query results that are in line with java
About 327,000,000 perl-compliant query results
About 238,000,000 python-compliant query results
Approx. 225,000,000 c++-compliant query results
About 176,000,000 ruby-compliant query results
PHP in the Web 2.0 era: still quite Loved
During this period, Ge You’s bald head was frequently exposed, and he always kept telling us one truth - the card that is used by more people is a good card. And if we apply the words of this bald star, that is, I believe in the people. From the results of the above query, you can see that the people love PHP very much.
But if you ask some senior developers on the Internet, who is better among PHP, ASP and Java? Generally speaking, this person will tell you that you don’t have to think about ASP, it is produced by Microsoft. Rubbish, PHP and Java are good choices. Java is suitable for large projects, and PHP is suitable for doing short and fast things. If you continue to ask, and the expert has not lost his patience, he will probably say that eBay, the largest interactive platform in the world, is written in JAVA, and CHINAREN, the largest community in China, is also written in JAVA, and many small The website was initially based on PHP, but later it had to be changed to JAVA for various reasons. This feeling is like saying, if you want to learn martial arts so that you can go out and kill people, or make a name for yourself in the world, then you don’t need to practice Marching Boxing. This thing is used by the government to strengthen the body, the Five Tigers Broken Door Knife. This thing is more than enough for you to deal with ordinary gangsters, but you will give up when you encounter a top master. Java is a bit like Tai Chi. The most popular martial art of SUN, one of the largest martial arts sects today, is the best choice for defeating masters. Therefore, many people believe that PHP is a low-level martial arts, and the best results from practicing it are to give If you look at the casino, you can become a martial arts leader only if you master Java.
When I chatted with technical managers of many companies, the managers said that many people have this mentality. He uses Java, and if you ask him to write PHP, many people will feel insulted. I either feel that the manager doesn't take him seriously, or I'm wondering when I offended the manager and was sent to a remote place like PHP. The larger the company, the more difficult it is to develop PHP projects. This makes many technical bosses very depressed, but it is also very strange. So, below, let’s analyze the formation of this language that is recognized by the people but not favored by many developers-PHP.
PHP before Web2.0: The reason for its popularity
PHP entered China in 1998 or 1999. When it entered, the typical early application was Chinaren alumni. There are also many interactive applications. It is easy to develop and has good fault tolerance, and it has quickly become the choice of many websites. In 2000 and 2001, during the Internet bubble, many websites were developed using PHP. Its popularity is due to the following reasons:
Compatible with C syntax, easy to master
In this regard, it ensures a stable source of developers. Basically, everyone who studies computer science has learned C language, so they can master it quickly in about one to two weeks. New language, and then with simple guidance, you can start initial development work. In terms of the development of the program itself, there is not much difference between a programmer who has been writing for more than three years and a PHP programmer who has been developing for more than half a year.
It runs fast
On the Internet, speed is a very important issue. In this regard, even people who are very disdainful of PHP have to admit that PHP The running speed is quite satisfactory, but since there is no very practical data, it is just the feeling of many people, so there is no very strong evidence to prove this.
Very strong fault tolerance, very good robust performance
Many people who write PHP should feel this way. For example, you apply for a variable in PHP , it can be used as a number, it can be used as an array, or it can be used as a string. Sometimes I wonder how it can ensure efficiency with such a casual style. I can only say that the person who wrote this language compiler is really incredible.
Rich functions and simple operations
If you can think of some operations that are not too rare, you can basically find a function library to solve them. The typical one is to read the contents of the file. Read a variable, so far, I know only PHP seems to provide a dedicated function to solve this problem.
PHP in the Web 2.0 Era: Advantages Become Problems
The above four characteristics are very common for developing programs with PHP, but as a program, these look The features that seem very good have also caused some problems with PHP, resulting in a low evaluation of it by many senior programmers.
First of all, the first one is something that embarrasses many senior programmers. They have been PHP programmers for more than 3 years. When a beginner asked them some tips, they suddenly discovered that PHP There is really nothing good to say about this language. You can solve the problem by looking at its help or taking a look at the tutorial. Unlike Java, there is a fundamental difference between a Java developer who has only been writing for about half a year and a Java developer who has been writing for more than 3 years. The latter can talk about a lot of JAVA development architecture and distribution issues, and the rookie who talks about it is full of confusion. Full of adoration. When I was giving lectures at PHPCHINA.CN, I found that everyone was drowsy when listening to some very detailed things in the PHP language, and most of them were deserting. I think this has a lot to do with the fact that PHP language is easy to understand and there are no challenging concepts.
The second point is still about efficiency. Regarding the efficiency of WEB languages on the market, PHP is just a perception. There is no very powerful test to prove that it is much faster than other languages. However, there is a very famous test performance comparison between JAVA and ASP.
Some people have done experiments to conduct loop performance tests and Oracle database access tests for these three languages. In the loop performance test, JSP used a loop of 20000*20000 for a total of four seconds. The ASP and PHP tests were 2000*2000 loops (one order of magnitude less), which took 63 seconds respectively. The PHP test is 2000*2000 loop for 84 seconds. In the database test, the three perform 1000 Insert, Update, Select and Delete on Oracle8 respectively:
JSP takes 13 seconds
PHP takes 69 seconds
ASP takes 73 seconds
An interesting test illustrates a problem. For a large number of operations, PHP It does not seem to be a very successful language. This is also a practical example that many experts are not very optimistic about PHP. However, the reality is that this is just a bit of a BT test. Who would write a loop on the Internet that lasts more than 4 million times? Request an application, I'd love to see it. In fact, such loops or intensive operations are very rare in WEB applications. If there are, the first thing to consider is the optimization of the algorithm and reducing the number of loops, and then the language itself. And even if it is necessary, it cannot be solved by Java, PHP and ASP. At this time, if it is used more, C will appear. If it is more used, assembly can be used. In many cases, the design of the chip is A better choice would never be the turn of a language like Java, so it is very inappropriate to use this method to evaluate PHP.
PHP in the Web 2.0 era: What is the future?
As for the better robustness in PHP development, it can run no matter how you write it, and it is very stable, which also causes PHP programmers to be unorganized, and the development of programs is very casual. Due to the urgency of Internet product development in China, there is almost no good documentation, so the maintenance of PHP programs in the later period has become a nightmare for countless project managers. This is also where many experts or senior programmers have a low opinion of PHP. When many project managers need to standardize development, they find that there is no way to standardize it. Java has Struts, MVC... but PHP lacks a system. The development architecture makes it difficult for PHP to become the choice for enterprise application systems.
As for the rich function operations, this is probably the only thing that has not been criticized, but Java, ASP and Perl all have very rich functions. PHP does not have a huge advantage in this regard, so it just becomes A not-so-important reason to choose it.