PHP also can be run in CLI mode, there are many libraries and extensions, WEB development, combined with GTK and other libraries can also develop desktop applications, why not replace Python, their grammar is also the pursuit of simple and fast, with the development efficiency for running efficiency, many places are very similar, And now a variety of training institutions to teach PHP more than Python, always feel that PHP uses more people than python.
Reply content:
I don't see how similar they are.
PHP weak type, Python strong type.
PHP main Web;python Master Universal.
PHP Early naming confusion, feature support is not full (Unicode, namespace); Python is much better than it.
PHP extensions are focused on WEB development. Do you have a reptile? Do you have scientific calculations? Do you have big data? Even process control is not well done.
PHP syntax is getting more and more complex (as is the case with C + +), and Python is relatively clean.
PHP does not even have a decent interactive shell (I found one, written in Python); Python not only natively supports interactive shell, but also Ipython, Bpython, Ptpython and other useful things, as well as data analysis-based Notebook
Can't even get SQL escaping before PHP? Python I just met when I was a DB API 2.0, right use, without worrying about SQL injection.
PHP into a pile of dollars; Python is more like plain text.
.......
PS: Why do you just say the disadvantages of PHP, the advantages of Python? Because I answer is "php why not replace python", not "python why not replace php"! PHP has never wanted to replace Python, if someone is so wound up, it is probably training organizations wantonly exaggerate PHP to fool you!
I used to try to solve all the problems with PHP, such as writing daemon, packaging desktop software, writing CLI tools, and so on, later proved to be futile, PHP is not suitable to do these, not to do, are Turing equivalent language, but other languages can do better.
Write daemon in PHP, it is easy to hit the CPU will soar to 100% of the situation, after I also met someone with PHP written daemon also jumped to 100%, but also frighten themselves. This can be caused by a time-out setting (stream_set_timeout), not destroying the ballooning variable in time, opening a new database connection without shutting down, and so on.
Later I did not use PHP to write daemon, because the PHP script feature is each request to complete the automatic release of all resources, so write not to consider the release of resources, timeouts and other issues, accustomed to such a way, can not be used to write daemon, nor suitable to write desktop software, Strictly speaking this is not the problem of PHP itself, but PHP spoiled you, misuse of resources and not released.
In addition to tangled up PHP is ugly shell, php-a, but each time to echo to come out, also can directly run PHP code, such as: Php-r ' echo times (); ',-R for Run, part of the code does not need to join Although Python sucks.
But to be rotten to be replaced by PHP Guido or go to rails I want to say: You are not stupid ... Invite me to do what I don't PHP
The only thing I know about PHP is the phrase "best language", but Python I hear mostly about "fit for beginners", "fit for math" and so on, first of all, fame goes up.
In addition PIP so many underwear you PHP where to find the main PHP in the web, most Web sites are PHP.
Python is the main command line, so you can see that many of the OPS tools are written in Python. The world's things are not interchangeable, competing with each other, all languages have their own advantages and irreplaceable value, both PHP and Java can be combined to develop enterprise-level projects, then there is no reason to exclude the command line of the sneak python? The right one is the best. Like asking who to replace mall.
It is not who replaces who, but each has a living space.
PHP was once thought of as the sunset Language, and later became popular with various frameworks, making the development of a product's technical requirements are increasingly low.
As far as community activity is concerned, there is no obvious strength between the two. Why didn't the pistol replace the rifle?
Because the effects are different, the scene is inconsistent