While it is starting to see more general usage, PHP is at heart a web-oriented programming language designed to output web-readable information, not handle system-level tasks. This difference is exemplified by the fact that you can develop a web server in Python that understands PHP, but you cannot develop a web server in PHP that understands Python. Finally, Python is object-oriented. PHP is not. This has significant implications for the readability, ease of maintenance, and scalability of the programs.
How Does Python Compare to Ruby?
Python is frequently compared to Ruby. Both are interpreted and therefore high level. Their code is implemented in such a way that you need not understand all the details. They are simply taken care of. Both are object-oriented from the ground up. Their implementation of classes and objects allow for greater reuse of code and ease of maintainability. Both are general purpose. They can be used for the simplest of tasks like converting text or for much more complicated matters such as controlling robots and managing major financial data systems.
There are two major differences between the two languages: readability and flexibility. Due to its object-oriented nature, Ruby code does not err on the side of being squirrely like Perl or PHP. Instead, it errs in being so obtuse that it is often unreadable; it tends to presume upon the programmer’s intentions. One of the chief questions asked by students learning Ruby is “How does it know to do that?” With Python, this information is typically plain in the syntax. Aside from enforcing indentation for readability, Python also enforces transparency of information by not assuming too much.
Because it does not assume, Python allows for easy variation from the standard way of doing things when needed while insisting that such variation is explicit in the code. This gives power to the programmer to do whatever is necessary while ensuring that those who read the code later can make sense of it. After programmers use Python for a few tasks, they often find it hard to use anything else.