Python vs PHP

Tim Roberts timr at probo.com
Sat Oct 23 22:46:42 EDT 2004


s4046441 at student.uq.edu.au (Shufen) wrote:
>
>Can someone who has use PHP before and know quite well about the
>language, tell me what are the stuffs that Python offers and PHP
>doesn't. A few examples will be nice. I know about the date format
>problem which PHP is having but I need more examples. Thank you for
>any help.

I'd like to mention one MAJOR difference that I've found in my
explorations.

As a language, PHP is quite adequate.  The class structure is usable,
although not as thorough and sophisticated as Python.  The run-time library
is VERY extensive (although all the names are in the root namespace), and
the online documentation is quite good.

The biggest difference, in my view, is the global archive of sample code.
There are many, many sites with sample PHP pages, snippets, and modules.
However, they are almost universally bad.  Monolithic code, no modularity,
no structure, no separation of presentation and processing.  No one seems
to use classes.

One could probably write a master's thesis on the reasons for this.
Perhaps it is because PHP is simple enough that it attracts inexperienced
programmers.  Perhaps the early versions of the language required hacky
programming, and the early samples not moved on.  I don't know exactly.

I do know that much of the sample Python code in the world represents
relatively good programming practices.  Most of the PHP code I've seen most
definitely does not.
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list