Pros of Python:
- Elegant syntax, clear namespaces - which means good code-maintainability in long run.
- Rich ecosystem and libraries (sqlalchemy, numpy, scipy, matplotlib).
- Out of box support for everything .
- Secure and easy to deploy websites With Django or Flask
- Easy to build API’s and we can get rid of using raw queries in DB_layer
Cons of Python:
- mysql library isn’t as good as mysqli of PHP.
- Not easy to host via cpanel/plesk.
Pros of PHP:
- Time tested and robust (CodeIgniter, Symfony, Laravel, etc. are written in that).
- Easy to implement and host (cpanel/plesk widely supported).
Cons of PHP:
- Tough syntax and usage (lack of standardization in function names, prone to messy code).
- Difficult to understand namespaces.
- sql injection and Phising attacks is very offen in PHP
Overall, I think python has more pros, whereas php has more cons, so my majority vote goes to the python side of my mind. However, I’d still like to know what most devs think here.