Both Python and PHP are very popular Back-End languages these days. It’s a hard decision to choose one, but I will make you choose PHP at the end of the day.
Python (https://en.wikipedia.org/wiki/Python_(programming_language)) is a general purpose programming language – that means it can be used not only for web development but also for creating desktop apps using any UI framework of choice, for example: PyQt.
PHP (https://en.wikipedia.org/wiki/PHP) on the other hand is a language desired strictly for Back-End web development. So after mastering it your playground is limited to the web only. Should be it considered a weakness of PHP? Definitely not. And I will explain why.
PHP has more web frameworks than Python.
PHP is designed for backend development only. That means there are much more ready to go backend frameworks. Short list of most popular PHP frameworks in 2021:
According to the Wikipedia page there are 38 of them in total.
Python has only two major and popular web frameworks:
Way more jobs for PHP Back-end developers than for Python Back-End developers.
PHP is used by almost 80% of all websites on the Internet by 2020. That’s a lot! That means you can easily find a job if you are a beginner, helping with some small task even on some old WordPress site will teach you a lot if you have no commercial experience before.
Problem with Python is basically that it’s rather rarely used by small and medium sized companies, so it can be very hard to find a job as a Python newbie. You would’ve needed to learn everything by yourself before your first job.
Newest PHP versions have “fixed” syntax. Your PHP code can look pretty nowadays!
Have you ever seen declaration of an array that looks that bad as It used to be in old PHP versions:
$someVar = array(‘firstElement’, ‘secondElement’, ‘thirdElement’);
I hated it! Now it’s commonly done this way:
$someVar = [‘firstElement’, ‘secondElement’, ‘thirdElement’];
Much cleaner and natural, huh?
And there are way more things that have changed. Just take a look at PHP update logs.