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.
I had a question about your line "just grab all the features from everywhere rather than carefully considering each one and its overall impact on the language -- which is something I've watched happen with the Python language over the last 10+ years."
Are you saying Python has carefully considered features or are you saying it has grabbed features from everywhere?
> "For example, PHP allows you to solve the idiotic HTML > problem where you can't easily include files." > > Server side includes? > > But why even do processing on the server at all when what > you really need is just a good templating language that > will generate static pages...
I thought that PHP was cool and good, before I discovered Python and Django framework. Since day one that I have started working with is one thing was clear: there is no way I will EVER use PHP without REALLY god reason. And for now I can't find one. PHP is in C age and even if they try to OO it unfortunately they haven't succeeded.
It's surprising that you even consider PHP cool after working with Turbo Gears and if I'm not mistaken Django as well, and mainly being Python friend :-)
I am not a PHP programmer, indeed, I don't know enough from the language to be able to comment it. But every time someone asks me why do I prefer Java I say: if you want something easy to use at the presentation layer, try freemarker. It is almost like PHP but protects you from having tempations to write spaghetti code...
> > "For example, PHP allows you to solve the idiotic HTML > > problem where you can't easily include files." > > > > Server side includes? > > > > But why even do processing on the server at all when > what > > you really need is just a good templating language that > > will generate static pages... > > Because using PHP as he says is easier!
I disagree. :-)
I use rest2web (but there are plenty of alternatives) and it generates static pages, very simply and with great flexibility.
> And then there's PHP 5, which is basically a kitchen sink of features grabbed from both C++ and Java
The above, while essentially correct, nevertheless indicates a lack of knowledge about PHP's roots. For instance, PHP4 was largely a "kitchen sink of features grabbed from Perl" (array_pop/push/shift/unshift), and PHP3 did much the same vis a vis ASP (short vs long style tags). So it should come as no surprise when PHP5 did much the same.
Flat View: This topic has 17 replies
on 2 pages