Developing a web application straight away in PHP is pretty trivial, the LAMP stack is pretty ubiquitous among web hosters, but without proper planning it will become a mess (spaghetti code, etc.) in no time.
As other in this thread already noted, Python’s learning curve is steeper, but on the long run it’ll yield better results.
Usually, I’d say: no matter the language you choose, if you’re a bad programmer, you’ll write bad programs.
That being said, Python was, is and — I believe — will always be a very elegant programming language, which pushes right from the start towards using some pretty good programming principles and patterns.
I cannot say the same for PHP, at least, until recently (PHP 5.3+).
There is this widespread misconception that PHP is a bad language. Well, in the past it kinda was, but, let’s face it, things are changed.
Writing a web application with no structure, no planning? No way. You’ll end up with a mess, no matter the language. That’s why we have frameworks; there a re plenty of them to play with, and each and anyone of them is pretty solid.
There is Symfony , Laravel , Zend , Cake , CodeIgniter , and many, many others . Each of them calls for robustness and reusability. Not to mention scalability and security.
The same applies for Python as well .
I believe, there is no better language: there’s only what you feel more comfortable programming with.
I’m working with a PHP few years and was very sad because PHP was my every day pain. After I moved from PHP to Python more that 2 years ago I can say what do I think about Python to PHP comparision:
1. Python has a philosophy that helps to write better for understanding code.
2. Language evolution planning using PEPs – you know what you get in a next few years. PHP development process looks chaotic: making OOP like a something in Java, then add some “static typing” collections, then include some lambdas and namespaces (almost after 15 years of development). What’s next?
3. Python has more compact and clean syntax that helps developers,
4. In Python the same things can be done the same way.
There is no matter what iterable things you using (list, tuple, string or something else) you always can access by index, get a slice, iterate over it or get the length the same way. No strlen()/count(), substr() and a lot of other functions.
5. More predictable and strict.
No 1 == “1” and other strange things like in PHP.
6. Python has more unified and powerful standard library. It has some problems, but python’s included library much better than PHP’s.
7. Python better working with exception. And trying to improve working with exceptions in future versions.
There is no errors like in PHP. Just Exception subclasses.
8. Better namespaces and importing.
9. Better OOP.
All the thing are objects (but with some limitations for int, float, etc.): types, functions, objects, modules.
All the objects can be introspected.
ABC, collections and other good batteries included.
11. Better support of functional programming style.
12. Better unicode support (much better in Py3k).
13. Syntax sugar for lists, dictionaries.
14. Interactive interpreter mode, and few different improved interactive mode implementations.