March 8th, 2020 at 4:49 AM
Updating this after a few years of experience. My verdict? Python is a far better language, but PHP isn't going anywhere.
They are designed for two different things. With web development, pretty much anyone could have a need for a website, and it pays to have at least some experience with the code involved. PHP kind-of has to be beginner-friendly for that reason, and hence it doesn't force you to initialize variables, has multiple ways of doing things first, etc.
Python is also very easy and is a go-to language for doing things quickly, but it's not built for the web. And as a result, has the freedom to do things a little differently than PHP. It can be a little more "proper" without having to worry about whether it's fully "web friendly" for a shared hosting environment such as GoDaddy or Hostgator.
Additionally, PHP has evolved. It likely became as successful as it is now, largely because it was at the right place at the right time. They have had no choice but to expand the language WITHOUT introducing major breaking changes. Some of the language's overall inconsistency stemmed from this. Python is much easier to introduce a new version for, and call it a day. They released Python 3 10 years ago, and Python 2 is still being used today. Virtual environments for Python are easy. (and for PHP, not so much, as you only get one version, and that's the version your host provides. )
So PHP has been forced, in a sense, to be extremely beginner friendly AND to be compatible with older code standards. I believe Python is a better language in terms of programming and its practices, but only because it can be. For web development, PHP is the best language we will ever have, simply because it's so widespread and heavily supported.
They are designed for two different things. With web development, pretty much anyone could have a need for a website, and it pays to have at least some experience with the code involved. PHP kind-of has to be beginner-friendly for that reason, and hence it doesn't force you to initialize variables, has multiple ways of doing things first, etc.
Python is also very easy and is a go-to language for doing things quickly, but it's not built for the web. And as a result, has the freedom to do things a little differently than PHP. It can be a little more "proper" without having to worry about whether it's fully "web friendly" for a shared hosting environment such as GoDaddy or Hostgator.
Additionally, PHP has evolved. It likely became as successful as it is now, largely because it was at the right place at the right time. They have had no choice but to expand the language WITHOUT introducing major breaking changes. Some of the language's overall inconsistency stemmed from this. Python is much easier to introduce a new version for, and call it a day. They released Python 3 10 years ago, and Python 2 is still being used today. Virtual environments for Python are easy. (and for PHP, not so much, as you only get one version, and that's the version your host provides. )
So PHP has been forced, in a sense, to be extremely beginner friendly AND to be compatible with older code standards. I believe Python is a better language in terms of programming and its practices, but only because it can be. For web development, PHP is the best language we will ever have, simply because it's so widespread and heavily supported.