(SCNR: Why the hell has Python a better reputation than PHP?
If you want a honest answer (and a strictly personal viewpoint):
When I tried to do something with PHP, I found it just as chaotic as perl (which I don't like either) - a bunch of stuff thrown onto a pile until all that is required would be present, but with no integral vision.
For instance, I needed some pictures, so I found a piece in there that would handle jpeg, and another piece that would handle gif (I think it was these two) - and the library calls and syntax was all different with both - no clean structure in there whatsoever. These and similar observations led me to the opinion that the main reason why it works at all, is that internal structure gets thown away again after each web request.
With python I never tried to really work - but I wanted to add full GSSAPI/SPNEGO support into pgadmin4, so I had to work thru that source - and I managed to do it, and it was not a bad experience. This leads me to the impression that python is quite a bit better structured - because otherwise it would probably not even be possible to add such a rather delicate functionality into unknown code without having any prior experience with the language.
For my personal taste I would prefer ruby, as there is an integral vision: it is OO to the very core, it is so clear OO that even me as an old-school assembler+C guy find a liking in OO. Whereas I was once forced to do perl with OO in s big project, and that was probably the worst PITA I ever encountered.