Home  >  Article  >  Backend Development  >  Is php a simple and easy language to learn?

Is php a simple and easy language to learn?

silencement
silencementOriginal
2019-09-28 14:33:102488browse

Is php a simple and easy language to learn?

The main reasons why I personally understand PHP to be simple are as follows:

The built-in API is very complete

Basic Don't look for a third-party library. This is much more convenient and more efficient for beginners. After all, you need to be familiar with and study a third-party library. You don't have to worry about it. The language is available directly.

There are many People just google the API and then use it. I was like this at first.

Java? We have more than 100 third-party packages in one project. . . . . , and these more than 100 third-party packages are selected from hundreds of packages. Beginners can use their brains to choose third-party packages by themselves!

Easy programming

Beginners can use PHP to write a process-oriented script. They only need to check the API. It can be done in 30 minutes; it can be done quickly Getting something done can give people a sense of accomplishment, which is very important; as for object-oriented, it’s not too late to learn it later.

Object-oriented in C and Java is simply a nightmare for beginners. There are no objects. Are you talking about object-oriented with me?

What if you use C or C to write process-oriented? Well, unless you write hello world, please take a good look at "Advanced Programming in UNIX Environment" and "Linux System Programming" first. If you don’t understand the operating system, don’t even think about writing C and C programs. Go ahead and play with simple data structures such as hello world or bubble linked list:)

Concurrency and memory management are simple
(Note: The following experience comes from PHP 5.3)
Concurrency: nginx php-fpm perfectly solves most concurrency problems. Programmers only need to focus on writing business logic, and threads are used in PHP Or process, either a very special situation, or a pain in the ass;

Java and C? It's hard to write concurrently, threads, locks, visibility, asynchronous IO, Reactor mode... Only after you understand these things can you play. If something goes wrong accidentally, you don't know how to check it.

Memory management: There is no problem with JVM garbage collection and everything is fine. If there is a problem locating and tuning, it will be a pain. On average, this happens 3 to 5 times a year. How to dump 24G memory? How to transfer the dump from the production server to the development server? What should I do if it takes 3 hours to open it with MAT after uploading it? . . . . . . Don't ask me, I don't know what to do!

C and C? If you encounter a memory problem, you will be in trouble: you can't locate it for a year, and then you can only write another script to restart it every month. I won't tell you which company you encountered such a thing, because I'm afraid of being beat!
Our PHP business has been running for 3 years, and memory leaks and memory explosions have occurred. It is easy to locate, but it has never been said to be tuned.

But it is not easy to write PHP well. In fact, it is very easy to write the business with PHP. However, if you use PHP to write the business well, you need very solid basic skills and the people who write the code are required to be very logical:

1)变量名本来是report,结果写成了reprot,运行OK,结果就是不对,面对一屏花花绿绿的代码,你要是能一眼看出那就是天才!
2)==和===,不说了,新手100%必中,高手80%踩中!
3)isset vs empty,和上一个类似

Do you think these problems seem to be minor problems? The principle of these problems is very simple, but the business problems they cause are all kinds of strange: some users are correct and some are incorrect, some users are correct in the morning but incorrect in the afternoon, and some users use Chrome correctly but incorrectly use Firefox!
After locating the problem, either you want to slap yourself three times, or you want to slap the person who wrote the code three times!

So I think PHP is the fastest language to get started with, but PHP is also a language that requires high rigor! Of course, for beginners, PHP is indeed the best language in the world!

The above is the detailed content of Is php a simple and easy language to learn?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn