People often argue about which programming language is superior, PHP or Python. This is a hard and somewhat incorrect question to consider. So let's get a little more specific. Python is a general-purpose language. A lot of programmers don't simply use Python for web development alone. With the right set of frameworks, it can be easily utilized for GUI application development and more complex things. Tkinter and Kivy may help you develop an application for a mobile or desktop platform. There are also Python libraries that are being successfully used for Big Data Science and Machine Learning. Offshore development companies make some crazy things with this programming language.
PHP, on the other hand, is mostly associated with web development. It's not like you couldn't make a non-web application in PHP.
So instead of doing a thankless job, we will try to decide what language is better to use for web development specifically.
Let us talk numbers.
PHP was created in 1995 and since then has gathered an enormous community around itself. Programmers around the world still develop frameworks to expand the functionality of this language. PHP was used in the creation of websites like Wikipedia, Facebook, Yahoo, and Tumblr. It undoubtedly dominates the web development market with its share of around 80 percent. So the question about which one is more popular, PHP or Python, for web development, is already resolved.
Python was created in 1991. There are much fewer Python made websites, but this language wins in a traffic-per-website competition. It is used in Google services, YouTube, Dropbox, Instagram, Pinterest, Reddit, Spotify, and Quora. It is also used a lot for the purposes of browser automation, machine learning, web scraping, data analysis and the Internet of Things.
If you plan on developing a website, you are probably going to choose between these two. Both have their advantages and disadvantages in certain situations, like many other programming languages. Both languages are open source and multiplatform. They both also have detailed documentation and an actively contributing community. But let us see how they differ from one another.
We already know that PHP is times more commonly used in the serverside web development than any other language. Its community has created many useful and popular frameworks for it: Laravel, Symfony, Zend, CodeIgniter, CakePHP and many more. With a decent knowledge and the right choice of frameworks, you can make the web functionality of PHP universal. Also, PHP syntax is quite forgiving, which some can assume a good thing. It is important to have some standards in the code. Otherwise, it gets unclean and hard to read.
Web development with Python is more user-friendly. It has less web dedicated frameworks but still, with Django, Flask, and Pyramid, you can cover nearly anything regarding the web. If you prefer an asynchronous approach, there are frameworks like Twisted, Tornado, AsyncIO, and AIOHTTP. You've got all the tools you need.
Also, this language has a much clearer syntax. It's strict but yet simple, highly readable and standardized. The resulting code in Python is always more elegant and transparent than the one in PHP. It will be easier to adjust and modify it later.
There is no such clear answer to this question. If you do want to dedicate yourself only to the web development and aren't afraid of any inconsistency in the syntax, you would probably consider choosing PHP. However, if you are new to the programming or haven't fully decided what would you do with the language you learn, try Python. With its easy learning curve and programming versatility, it is going to be a great way for you to start programming stuff.