46 comments

[ 3.5 ms ] story [ 114 ms ] thread
It is? Strange, mine still works. Am I a PHP zombie?

On a side note: I'm tired of the "Pull a Calacanis" type of headlines like "x is dead", "x sucks" or "x is bullshit".

Please come up with something better.

(comment deleted)
I'm tired of Calacanis too.... please pull a Scoble and say "x will kill x-1"
It's too bad that standard hacker slang for "I am incredibly disappointed and feel like kicking something today" is so similar to linkbait. But, really, what is one supposed to say when one discovers this:

$this cannot be used in lambdas or closures. So, when it comes to using these new features with objects, they're quite nearly completely useless.

... except "This is bullshit?" I mean, that's the censored version of what I think about this.

Exactly! I'm not interested in link bait. I'm just really depressed after I finally made the realization--just last night--that the language I've been using for years is going nowhere but down.
It looks to me that the only thing going down is you, as a programmer. You've been writing PHP scripts all your life, I understand why you are depressed.
(comment deleted)
It's a crappy title, but the article is pretty good.

PHP is a niche language, the niche is probably best described as "for want of something else that seems so easy to use and has such a low barrier to entry we are forced use it for web development".

The interesting thing here is that apparently the difference between PHP and the 'rest' of the languages out there is not large enough to supplant PHP in the WWW domain.

It's close enough to C that a whole generation of C programmers is intuitively at home in PHP, until they start using its advanced features.

But as long as you have to do simple stuff and get paid for that it almost always works. The few times that it doesn't you wished you never knew about the language though.

Just imagine, a language where the default 'scope' is global but globals are not available to functions and silently get replaced with empty variables. Who came up with that gem ?

And that's where PHP truly fails. On the surface, it appears to have many nice, advanced features. But they're implemented so poorly. They're not thorough about use cases or testing.
The default scope within a function is not global, and all global variables are available within a function by using the keyword "global". You can also access the superglobals, but that of course is optional.
hacking the procrast to be able to answer you...

The default scope is global, I did not say 'within a function'.

I know about the 'global' keyword, as does everybody else that has used PHP for more than 5 minutes.

If your language has a C like syntax and you have a default scope (which means that you can start executing code right from the first line without being in a function definition) then the default behaviour of a variable should be that it either does not exist inside a function (different scope) and throws an error or it should refer to the global variable.

To have a 'third option', which silently creates empty variables is very (no, make that extremely) poor design.

And no, I'm not telling how to break noprocrast :)

The interesting thing here is that apparently the difference between PHP and the 'rest' of the languages out there is not large enough to supplant PHP in the WWW domain.

Very astute observation. PHP doesn't have to be the best. It just has to be good enough to maintain it's place.

If you are trying to do something "more advanced", why are you trying to use PHP at all? What do you consider "advanced"? Just the WAY you use the language, or the application you are trying to write?

PHP is trying really hard (it seems) to be a more advanced language, possibly to get new users to move over from other languages.

But they don't need to.

They should just stick to their roots, do what they do best:

Super small learning curve, low barrier to entry, it's everywhere, it works great for most apps, keep CRUD super-simple.

My biggest interest in PHP is job-related. I work for a large travel website whose software is all OO PHP. If it weren't for that, I'd probably be in Perl-, Ruby- or Python-land.
So far I have not personally run into anything I _can't_ do in PHP - it may take some creative thinking, but there is usually a solution - this includes "advanced" functionality as well.

I think what a lot of the issues people have with PHP is not that it can't do something, but more that many of the ways you implement something feels like a "hack" - it works, but isn't as elegant as other languages.

I wish they would have put more effort into deprecation and cleaning up past messes instead of building new features to attract serious developers and making things even more of a mess.
I found the repeated misspelling of "lambda" to be off-putting.
it's odd because it's one of those words that's hard to imagine someone having learned only through spoken language.
Fixed, thanks for pointing that out. And as "the guy who built Digg.com for $10/hr", that's all the feedback you'll give me?!
I use php everyday, and as the guy who built digg (in php) I'd say - I agree with everything you say, but 99% of business has nothing at all to do with what programming language you use. But, _intellectualism_ does have plenty to do with building a successful business, and for most developers, that manifests itself as language wars. So I liked the article from that perspective.
Yes, I understand the business side. But I studied Computer Science in school. I take pride in my work, and I regard an expertly-forged piece of code as a work of art. It's not simply a means to an end, and, even if sometimes I complain a lot, I hope even my employer sees the benefit in my taking what I do so seriously.
Haha, you are not Van Gough, you are a code monkey. You think your code is a piece of art, but the guy who's going to maintain it may think it's a piece of shit and can end up rewriting it, using a different language, one he thinks is better. Just like you did, Mr. van Gough ;)
I usually don't jump into these kinds of threads. You get an awful lot of programmers -- some hobbyist, some professional, some experienced, and most of them self-taught -- all with their own prejudices and methodologies, all arguing over what the "right" way is. They go absolutely nowhere, do nothing productive, and turn into a huge time sink for everyone involved.

That said, this article, and every other one like it, reeks of some strange belief that every single language is supposed to have all of the features of some programmer's favorite language, as well as all of the neat new trendy stuff, and if the language doesn't support all of that -- well then it's dead! Or dying. Or "a husk".

There doesn't seem to be any realization on the part of the programmer that a particular language is just a tool, usually designed for a specific application. The programmer is attempting to fit a square peg into a round hole, and they're cursing at the square peg because it doesn't fit.

Let's take one example: closures. They sounded interesting, and potentially could solve a problem in a large JavaScript library I was working on. So I got to know them, I practiced with them, I made sure I grokked them before trying to apply them. Then I put them to work, and found that they ended up making my library unnecessarily complex, that they caused some odd behaviors occasionally, and that they didn't solve any problem that I couldn't more easily solve using simpler methods.

So, does PHP's lack of this author's favorite features really make it a "husk"? No, not at all. Applications as large and complex as osCommerce don't rely on those language features; they rely on the features that the language does have, and they work just fine.

One of the most basic skills programmers need to have in their toolbox is the ability to adapt their habits according to the tools they're using. The programmers that spend their time writing blog posts like this one don't seem to have picked that up.

...Ugh, this just cost me 10 minutes that I could've spent actually working on one of my projects. :-(

I'm not complaining about what features PHP has. In fact, I was never that annoyed that PHP didn't have lamdas or closures until now.

My problem is that it wasn't implemented _correctly_. If you're going to implement a feature, do it right or don't do it at all. Their lack of concern or pride in their project does not bode well for the community.

This is a reasonable statement.

But there's a bit of a delta between this and the attention-grabbing title of the post.

Sorry; it wasn't meant to be attention grabbing. It was more out of frustration, I suppose.
If there's anything good about PHP that I can tell, its that development is heavily community driven and has been since the early days. However, I think PHP got so popular, and so quickly, that in many cases the community's desire for features has led to an inconsistent, and in your view, 'broken' system. The need for backwards compatibility from almost the very beginning has taken its toll, I think. Is it really 'broken' though? Of course, similar concepts have been implemented in other languages much more elegantly. But PHP is not about elegance - it's about backwards compatibility, and responding to community feature requests.

I'm not a part of the community, and I'm no longer a PHP developer (if I can help it) but I can't think of any other reason the global functions would still have inconsistent argument orders almost 14 years on. So, if the 'correctness' of their implementation bothers you, do what I did: move on. Because it will never get any better.

Incidentally, I wrote an anti-PHP rant last year called "Why PHP Won" that made its rounds here. It's pretty easy to get fed up with PHP, especially when you know there's better stuff out there. Once you're at that point though, you're done. It's anything-else time.

My comment wasn't entirely directed only at your post. The most common complaint against PHP (and other languages, frameworks, etc.) is that it doesn't support the features or methods the programmer expects.

That said, in direct reference to your post: so what? My point still stands. I don't disagree with your assessment of the way it implements those features, I just don't think that it means "there is no hope for PHP", and I don't think it's at all productive to waste time complaining that it doesn't behave the way you want it to.

PHP -- and most other languages -- do have the power to "hack something together". You just have to be willing to adapt to the system at hand.

Thank you for this - I'm the author of a very large PHP application that has been in development for 7 years, and it _works_. We don't use a lot of the more advanced features in PHP, since our target support is PHP 4.3.0, so this leads to some creative (i.e. fun) problems at times. PHP is as "complete" as it needs to be for us.

It reminds me of a time when I had to maintain some very large programs written 100% in AWK - talk about a limited feature set - you had to work with a more limited set of functions and features, but often led to some creative solutions.

"...our target support is PHP 4.3.0, so this leads to some creative (i.e. fun) problems at times."

"PHP is as "complete" as it needs to be for us."

It's so complete that it's painful to write in? There's something to be said for languages that focus on a particular application while peripheral features suffer, but the PHP language is in no way superior to Python or Ruby, even in regards to web development, and there's no problem with saying so.

People use PHP because lots of other people know it, and because it's widely available. Those aren't merits of the language itself. Yes, good things can be written in PHP. That doesn't mean the language isn't demonstrably inferior.

PHP fits an important niche. People sometimes use PHP because it is faster and has a smaller memory footprint than Python or Ruby.
I was considering language features separately. If you're trying to pick a language, no one would pick PHP unless they need to work with people who already know PHP. If you're trying to pick a runtime, PHP occasionally makes sense due to ease of deployment, memory issues, etc.
I'm guessing your definition of pain is different then mine - I don't have any issues with writing PHP - it just works for me. I've been developing in PHP since 2002, so by now I'm used to the language and how it works, and don't really have any expectations for new features.

I can see however that coming from a language like Python or Ruby, you're probably going to try to develop in PHP like you would in one of those languages - and I believe that is where frustration will be found. I think it's good to think of PHP as a "simpler" language - stick with the basics and it will work well (as well as be pretty fast).

"...our target support is PHP 4.3.0, so this leads to some creative (i.e. fun) problems at times."

"I don't have any issues with writing PHP - it just works for me."

Maybe it was a poor choice of title, but the thrust of the article is that closures supposedly are available in the language, but the implementation is so poor as to be unusable.
There doesn't seem to be any realization on the part of the programmer that a particular language is just a tool, usually designed for a specific application. The programmer is attempting to fit a square peg into a round hole, and they're cursing at the square peg because it doesn't fit.

Ummmm, wrong! The author isn't saying "PHP sucks because it doesn't have closures like my favorite language, so it's dead to me!". The author is saying "PHP claims to support closures, but when you actually attempt to use them for anything useful, they're broken."

So what he's actually cursing is that he has a round hole, and something that looks like a round peg, except it's really not.

Part of the problem is that once you start using closures and lambdas all over the place, it's really hard to go back to a language without them. Yes, some tools weren't meant to do some jobs, but PHP's competition has those features, and they work, and they work well. If they wanted to make a simple language without those features, fine, but that won't stop people from complaining that it doesn't have them, and it won't stop people from complaining when those features don't work the way that everyone else's versions of the features work.
My guess is that many developers probably don't actually choose PHP per se but rather get stuck using it because that's what the shop they work for uses, or that's what the current site is implemented in and they're only adding a feature, or that's what the client is asking for, etc.

More interesting to me is the question: Why is PHP beating Python in this space? Some guesses:

* PHP webapps far easier to deploy.

* PHP docs give more usage examples, and also allow user comments.

I don't think the lambda and closure support was intended to mesh so succinctly object oriented features of php. You have to realize php is a multi-paradigm language and proceed accordingly. You can honestly implement your own oo system using arrays and anon functions/closures if you would like (much like perl). The only thing making it a little fugly/brutal is the HORRIBLE php "array(" syntax.
Very mediocre post. Including the comments.

"Use php, python, no, use ruby instead! Facebook uses PHP, YouTube Python, blah blah".

Kids, kids, behave! Scripting languages are for kids and web developers who don't know anything about programming and software engineering.

I've worked with Perl and Python developers for the last couple of years... they struggle to understand design patterns and don't even know what a domain object is.

Very mediocre post. Including the comments. I think scripting languages are for kids and web developers who don't know anything about programming and software engineering.

I've worked with Perl and Python developers for the last couple of years... they struggle to understand design patterns and don't even know what a domain object is.

Very mediocre post. Including the comments. I think scripting languages are for kids and web developers who don't know anything about programming and software engineering.

I've worked with Perl and Python developers for the last couple of years, they struggle to understand design patterns and don't even know what a domain object is.

I think scripting languages are for kids and web developers who don't know anything about programming and software engineering.

I've worked with Perl and Python developers for the last couple of years... they struggle to understand design patterns and don't even know what a domain object is.