As a developer, you often see news on the Internet about the reasons for not using XX. As the most popular open source server-side scripting language, PHP cannot escape this fate. As everyone knows, no gold is perfect and no one is perfect. No matter how popular the language is, there will always be shortcomings or misunderstandings. Therefore, some developers may stay away from it just because of these. Isn't this a pity?
The author of this article summarizes the top ten misunderstandings people have about PHP and clarifies them. Some misunderstandings are worth pondering, while some are just baseless. Anyway, let’s take a look at these misconceptions.
1. PHP is an object-oriented language, but it is not based on OOPS
This is a completely incorrect understanding, especially for Java programmers, who think that PHP is not based on OOPS; but they will find many object-oriented features, such as interfaces, methods, abstract objects, etc. To be honest, the initial version of PHP did not have many object-oriented features, but PHP 5 adds many object-oriented technologies. More importantly, you may be curious why Bootstrap code becomes so simple in PHP. This is due to the combination of PHP and OO.
2. PHP cannot implement specific functions
This misunderstanding sounds vague, but many developers believe that PHP cannot implement other functions such as memory access. But the fact is that PHP is an extensible language. You only need to write an extension in C or C++ and integrate it. Or, you don’t need to create one. There are hundreds of extensions available online, and you can use them directly as needed.
3. PHP is not safe
Since you think it is unsafe, why not write safe code for it. I admit that there is a lot of unsafe code in PHP, but as programmers, we should try to write reliable and safe code.
If you compare PHP with .NET, PHP will definitely fail. But if you're a skilled programmer, you don't need security "help." Includes day-to-day security concerns, but if their paths are dynamically generated, then you have to be careful. Of course, it might become safer if you master all the commands.
4. Not suitable for large applications
The reason why a language can be used to build large and complex applications must have a certain degree of reliability and high performance, and scalable PHP does not meet this requirement. But if the application architecture you design and develop is stable, what's the problem with application performance and scaling?
The fact is that some well-known websites are designed using PHP, such as Facebook, Wikipedia, and Yahoo!, etc., and they all work very well.
5.PHP can only be used for website development
Indeed, it is very common to use PHP for website development. But the command line interface (CLI: Command Line Interface) allows applications to run on non-Web servers.
Although some applications have high CPU requirements, they can still be developed and run in PHP by executing the PHP CLI. What's more, if you want to develop desktop applications using PHP, just use Windows-specific extensions.
6. The development process is slow
I really don’t know where this misunderstanding came from. It's possible that the PHP code you wrote is messy and filled with a lot of MySQL statements (which, although they make sense, really shouldn't be there). In fact, PHP has a large number of frameworks for developers to use. Proper use of them will achieve twice the result with half the effort and greatly reduce development time. So, don't complain about being slow.
7. Professional developers do not use PHP
Regarding this misunderstanding, there are various opinions in the market, such as PHP is a piece of cake for beginners, it is prepared for those who do not want to take development seriously, etc. Of course, I have to admit that PHP does not make sense in some aspects, but such misunderstandings are really ridiculous. If many web applications here are developed using PHP, then imagine that developers who have always been rigorous are staying away from PHP, which is completely wrong.
8. Performance issues
This is a technical issue, not a misunderstanding. Everything has its good and its bad. Performance optimization has always been a topic discussed by developers. In fact, for applications with low performance, they may be filled with a lot of junk code, such as implicit conversions, useless modules, lack of overloading of operation methods, etc., which will affect the performance of PHP applications. But it ultimately depends on how you use the language to create a stable and fast application.
9. Cheap apps mean low quality
In a market environment where open source is gradually becoming mainstream, free and open source are the biggest advantages of PHP. This means that most developers with expertise can provide development services and also save costs for clients. But this does not mean that there is a problem with quality, and high-performance applications can also be developed.
10.PHP is overrated
Well, this may be just your personal opinion, most PHP programmers will not think so.
Write at the end
As language continues to develop and grow, various misunderstandings will follow, but no matter what, some false rumors will be dispelled without attack. As the saying goes, practice is the only criterion for testing truth, so before choosing to believe or not, it is best to test it yourself.
English source: Bestdesigntuts
1. Repay evil with kindness
Original sentence: "One might say: 'How about repaying evil with kindness?' The Master said: "How to repay kindness? "Repay vengeance with kindness, repay kindness with kindness" - "Analects of Confucius"
I never expected that there was another passage after Confucius's sentence "Repay grievance with kindness". What was it? Confucius said: "Repay kindness with kindness, why should we repay kindness with kindness?" Repay kindness? Repay vengeance with straightness and repay kindness with kindness! "After reading it, I suddenly realized that we have all been played by some Confucius FANS who quoted it out of context!
What was the real situation at that time? One of Confucius' disciples asked him: Master, someone beat me Well, instead of beating him, I want to be nice to him, shame him to death with my morality and education, and make him repent, okay? Confucius said, "If you repay evil with kindness, why repay kindness with kindness?" When someone treats you, you need to repay others with kindness; but now that someone hits you, you should 'repay them directly' and throw bricks at them! "
Degree of distortion: 8
Negative impact: 9
2. The people can follow it, but cannot make it known
Original sentence: "The Master said: Prosper in poetry, establish in ritual, and achieve in music. . Confucius said: The people can follow it, but they cannot know it. "——"The Analects of Confucius·Qin Bo"
Combining the context, we can easily come up with the correct phrasing method of this sentence: "The Master said: Xing is based on poetry, established on etiquette, and achieved on music. If the people can do it, let them follow it; if it can't, let them know it. "
The whole sentence of Confucius is that poetry, etiquette, and music are the basis for educating the people, and they must be done well. If the people master poetry, etiquette, and music, good! Let them develop freely; if If the people are still unable to play with these things, we must educate them and let them know and understand these things. This is the original intention of Mr. Kong, the great educator who "educates everyone"
Degree of distortion: 7<.> Negative impact: 9
3. No poison is not a husband
Original sentence: A person who is too small is not a gentleman, but a man who is too generous is not a husband. ——Folk proverb couplet
This proverb from the folk should have been "Measurement". "You are not a gentleman, you are not a husband." This is originally a very good sentence, and it makes full use of antitheses. It shows a masculine and powerful spirit, and the image of a magnanimous man appears on the page. Unfortunately, it is a pity that the working people have heard it. According to legend, this sentence changed its taste when it came to the so-called "gentlemen" in the imperial court. Why?
It starts with the habits of ancient literati, in this couplet style. In the proverb, the word "du" is in oblique tone, which is awkward to pronounce, and it is easy to read as the flat tone word "du". Those scholars who have high requirements for musical beauty have nothing to do one day, so they use their expertise. To make a statement, I changed this sentence to "No poison, no husband"
Distortion level: 9
Negative impact: 5
4 Only women are difficult to raise with villains
Original sentence: Only women. It is difficult to raise a villain, if you are close, you will not have grandchildren, and if you are far away, you will be resentful. - "The Analects of Confucius Yang Huo"
In "Historical Records of the Family of Confucius", it is mentioned that Confucius' previous trip to defend the country, Confucius " After staying in Wei for more than a month, Duke Ling and his wife were riding in the same carriage. The eunuch Yong Qu came out and asked Confucius to ride second, and passed by in a showy way. Confucius said: "I have never seen anyone who loves virtue as much as he loves sex." ’ So the ugly one went to defend him. "
Let me roughly translate this passage. Mr. Kong, a contemporary national education model worker, was invited by the monarch of Weiguo to visit, study and recuperate in Weiguo. But during this period, Mr. Kong suddenly found that he was being cheated. They were simply using his status to show off and promote themselves, and they did not really support him in coming here to educate the people of Wei State. Especially the wife of Wei Linggong, who publicly showed off and belittled her in order to improve his status. Confucius.
Mr. Kong was very depressed, so he packed up his luggage and left the Kingdom of Wei. After leaving, he calmed down and remembered the arrogant and domineering behavior of the wife of the Duke of Wei, who relied on being favored and disturbed the government and disturbed the people. She lamented: "Only women and villains are difficult to raise! If you are close, you will not appreciate it; if you are far, you will be resentful. "
Looking at Confucius's trip to defend the country, everything becomes clear. His words were definitely not out of his mind and suddenly cursed all women, including his own mother, but he had a specific target. This target, It’s Wei Linggong’s wife Nanzi and others.
Distortion level: 6
Negative impact: 9
5. My life also has a limit, but my knowledge has no limit.
Original sentence: My life also has a limit, but there is no limit. Knowledge has no limit, and as long as it has a limit, it is boundless, and it is already gone——————"Zhuangzi·Health Preserver"
This sentence of Zhuangzi actually says this, "My life also has a limit, and knowledge also has no limit, so I have no limit." There is no limit but there is no limit, it is almost gone. "My Zhuangzi life is limited, but the knowledge I face is infinite. If I have to use my limited life to pursue something that can never see the end, I will kill myself."
Distortion ......The rest of the full text>>
Hey, stop looking, I haven’t seen one as powerful as dz. The amount of data in phpwind, vbb, etc. is still not as large as dz, let alone anything else.
If you don’t like it, you can change the style. . What others recommend may not meet the requirements if you read it.
There are many pictures that can be optimized. Speaking from experience, zend-optimized dz is definitely the first in terms of performance, not the second, and it is still better than dz. It’s worth spending more energy.