The Artima Developer Community
Sponsored Link

Computing Thoughts
What's Cool About PHP
by Bruce Eckel
May 26, 2008
You can just use it a little bit.


This is actually very impressive, that you don't need to know much about the language in order to make valuable use of it. How many languages do you know where that's possible? At the other extreme end of the spectrum is Java, which requires a bunch of knowledge for hello world, and a boatload to get a web app up and going. In PHP it's trivial.

That said, PHP is only somewhat better than Perl when it comes to inviting bad behavior. I remember back in the rising days of the Web, hearing people say they were going to build big applications in Perl, and just knowing (with no hope of convincing them) that they were going to fail.

PHP, on the other hand, has definitely created some larger apps. Drupal, for example. My friend Nancy Nicolaisen (a blogger here) said she wanted to put up a travel web site and I suggested she look at Drupal. She did, ended up choosing it -- primarily, she said, because the user community was so nice and helpful -- and got her site up and running with a minimum of fuss.

And PHP allows novices to cut to the chase and do things they are directly interested in without messing about with a lot of programming theory and practice. You just do it and it shows up on your web page.

But that's also the problem with the language. You can find tons of completely wrong examples of how to do something in PHP, written by people who are copying each other because no one knows what questions to ask. One of my first forays into the language I wanted to see examples of file locking in PHP, and found lots of them, every single one wrong. Arguably, PHP is primarily intended to be used with a database which then handles all the consistency issues for you so most people just go for that and don't have to think about the lower-level issues. But the language treats high-level interaction with a database the same way it treats low-level interaction with the file system, so there are no "here be dragons" signs that language beginners need, and my perception is that there are so many "just get something done" folks in the community and very few who really understand fundamentals, so the tendency is to do it wrong when you innocently venture into rocky territory.

And then there's PHP 5, which is basically a kitchen sink of features grabbed from both C++ and Java, and while it's impressive that they were able to get it working with that conglomeration, my spidey-sense starts tingling when someone seems to just grab all the features from everywhere rather than carefully considering each one and its overall impact on the language -- in contrast, I've watched the Python language make careful choices over the last 10+ years. Time will tell, and maybe the PHP community will figure out what to do with all those features, but I'm deeply suspicious.

In the meantime, I use PHP on my new, slowly-evolving site implementation. The key: I use it only in very small bits. For example, PHP allows you to solve the idiotic HTML problem where you can't easily include files. PHP just does it, and allows me to easily distribute my design throughout the site. And sometimes you just want to do something small and embed it in your page, and PHP is the right answer for that.

But as soon as something starts getting the slightest bit complex, I find that it's better to switch to Python for that bit. So PHP is great in small pieces, but I don't try to push it very far.

You can find a good collection of links to discussions, rants and arguments here.

Talk Back!

Have an opinion? Readers have already posted 17 comments about this weblog entry. Why not add yours?

RSS Feed

If you'd like to be notified whenever Bruce Eckel adds a new entry to his weblog, subscribe to his RSS feed.

About the Blogger

Bruce Eckel ( provides development assistance in Python with user interfaces in Flex. He is the author of Thinking in Java (Prentice-Hall, 1998, 2nd Edition, 2000, 3rd Edition, 2003, 4th Edition, 2005), the Hands-On Java Seminar CD ROM (available on the Web site), Thinking in C++ (PH 1995; 2nd edition 2000, Volume 2 with Chuck Allison, 2003), C++ Inside & Out (Osborne/McGraw-Hill 1993), among others. He's given hundreds of presentations throughout the world, published over 150 articles in numerous magazines, was a founding member of the ANSI/ISO C++ committee and speaks regularly at conferences.

This weblog entry is Copyright © 2008 Bruce Eckel. All rights reserved.

Sponsored Links


Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us