Ah, Erich, that IS so true. I never found a well written PHP application anyway, or it was only 10 lines long.
I guess that's primarily the language fault. It permits to do a lot of stuff and does not simplify, help nor force the simplest implementation methods like MVC which should be the base in Web developement.
Well, take as example what we would do with Python and GTK+ if they were like PHP and HTML (I do not have the API reference so it will be somewhat improvised):
#finally we do not need this module I wrote everything myself
#import somemodule
def main():
# Well we want to do some printing
window = GtkWindow()
# Connect to the database without any abstraction, that sucks
db = mysql.connect()
data = db.query("select RANDOMLYTYPEDDATA from MYONLYTABLE");
while data:
# Ah, we do not have include() so we cannot reuse code
# I'm a PHP developer, I do not know functions
import somestuff
window.print(somestuff.result)
# Obviously, forgot to close db connection, etc.
if form.data.field == "hello":
# The user asked for hello, print hello
window.print("hello")
# debug
print data[0]
if form.data.anotherfield[0] == "morning":
data = db.query("select anotherdata from MYONLYDATA")
else:
sys.exit(42)
label = GtkLabel()
# Yes know we construct the view!
window.add(label)
label.print(data)
That is typical PHP code: we just take randomly typed data from our DB eng... no wait, from MySQL (remember that's LAMP!!! Not LAPP or anything else, bitches!), then we print some HTML code with data, and we do tests on environment, forms, etc, and we get back data, reprint them, do not use functions but include() multiple times thousand of files and then do not close/free anything.
It's so easy to do bad code that lot of people coming from nowhere and who did not learn anything from other languages are doing it.
Another hypothesis coming from my experiment: PHP is a language which can be developed under any OS since it's server-side executed. A link between mostly brain dead "developers" from the Microsoft world and whose from the Free Software world. A clash.
I apologize to some of my coworkers doing better PHP all the day. 