10 major pitfalls to avoid in PHP language
PHP is a very popular open source server-side scripting language, and most of the sites you see on the World Wide Web are developed using PHP. However, you are probably surprised to notice that a small number of people swear to be far away from PHP. But it's even more surprising or shocking to say that they don't use PHP because of some proven language drawbacks. They decided not to use PHP, which was based on misunderstanding.
Yes, the ones you read are misconceptions.
Let's take a look at these misconceptions:
1. PHP is an object-oriented language, but object-oriented is not completely
This is totally wrong. All programmers who think PHP is not a complete object-oriented programmer, especially Java programmers, need a basic training in PHP, and they will find a lot of object-oriented features in PHP. For example: interfaces, methods, abstract classes, and so on. I agree that earlier versions of PHP did not support too many object-oriented features, but PHP5 already has strong object-oriented support. And, you can't imagine how easy it would be to code in PHP because of the combination of PHP and object-oriented.
So, eliminate this misunderstanding.
2.PHP cannot implement specific functions
I am well aware that this statement is vague, but I cannot think of any better statement. This is a very vague misconception that developers don't think PHP can help them implement features such as memory access or features that are not supported by major PHP distributions. But the fact is that PHP is an extensible language, so what you need to do is to encode it in C or C + + and then create the corresponding extension.
In fact, you don't need to create extensions yourself, because there are already hundreds of available extensions. The only thing you need to do is to look for them.
3.PHP is not safe.
Another misconception that developers have about PHP is that PHP websites and apps are unsafe. But why would you want it to be safe by default, and why not write secure code? I know there's always a lot of unsafe PHP code here, because the initial learning curve is simple and easy to get started with. So, as a developer, you need to make it as safe as possible.
. NET can help you to be safe by default, compared to PHP is really a lot of missing. But if you are a well-trained programmer, then you don't actually have the security help by default. The include is usually safe, but you need to be careful. If their paths are dynamically generated, a thorough understanding of the instructions can help you make your code more secure.
4. It can't adapt to large-scale applications
Large and complex applications need to be built on their own reliable and high-performance language, which is something that PHP does not have in some way. But if you design and develop an application architecture that is stable, why do you have questions about its performance and scalability?
In fact, some of the top websites, such as Facebook, Wikipedia and Yahoo, are built on PHP, and as we all think, these mega sites work well.
5. PHP can only be used for website development
This is also a misunderstanding, although it seems a bit logical, because PHP is the most common language in web development. But there are also things called command-line interfaces that make sure your PHP application can run outside the Web server.
You may not believe it, but even those applications that largely depend on CPU power can be developed in PHP and run using the PHP CLI.
More importantly, if you want to use PHP to develop desktop applications, don't worry, you can do this with Windows-specific extensions.
6. Slow development process
This is a misunderstanding that has been widely circulated. I don't know where it originated from? This rumor may have come from a time when PHP code was messy and the code was flooded with MySQL statements (they used this as a counter-example, but we didn't actually use it). The question is why is the development process slow? When a large number of PHP frameworks appear, you can greatly accelerate the development process. There is no doubt that you can develop very large programs in a short period of time, no matter how complex it may be. So, you're not slow to develop PHP, especially when you're using PHP frameworks.
7. Professional developers do not use PHP
PHP is intended for beginners, and it is designed for people who are not really serious about doing development. These statements are related to the use of PHP. It's just a misunderstanding, and it doesn't make any sense to agree with it. There are so many Web applications, including some large ones, that are built using PHP. You can imagine how wrong these statements are.
8. Performance issues
This is a tricky question. This is not a misunderstanding. And coins have two sides, this problem is also two aspects. In fact, there are garbage codes everywhere, implicit conversions, non-applicable modules, missing operator overloads, and so on, which can affect the performance of a PHP application. But this depends on whether you have enough ability to use the language well and use it to write stably and quickly.
Performance is determined by the architecture you design and the code you write!
9. Cheap not good goods
This seems to be a logical stand, but the use of PHP that is completely misunderstood! In fact, the biggest advantage of PHP is his free and open source, which means that most developers who provide app development services must be proficient in it. While free open source can pose a problem, it also provides a cost advantage for customers who use their services. Compared to the commercial development language, PHP's development costs are low, but this does not mean that its quality is questionable. Work with the right developers to get higher-performance PHP applications.
PHP exaggerated
Is that true? You're just kidding. I don't think so, and a lot of developers don't think so.
Conclusion
This is not the terminator of all PHP lies. As the PHP language continues to evolve, it becomes more powerful and misunderstandings grow. But please don't be fooled by them. Read more, ask more, move your own hands, then you know, is not really.
English Original: PHP language–top misconceptions to Avoid