Dear PHP, I think it’s time we broke up.

Dear PHP,

We’ve been together for about five years now. I’ve had a lot of good times and I’ve really enjoyed being with you. However, the more we work together, the more concerned I get about our future. I’m sorry, but you don’t have the elegance that inspires me to want marry you. I think it’s time we broke up.

I think the biggest problem is you just don’t know who you are; it seems to have haunted you your entire life. You originally started life as a useful collection of Perl scripts for maintaining an online resume and were aptly named “‘Personal Home Page Tools”. That’s fine; I think most open-source technologies are born because a single person needed a specific itch scratched. However, then something weird happened. You were recreated by two new, adopted parents in 1997 and quickly promoted to version 3.0. The most obvious hint of this burgeoning identity crisis was that you were stripped of your name and given the nonsensical monkier “PHP: Hypertext Preprocessor” instead. Why were you ashamed of your roots? I think this may have been the first sign that you’re lacking a guiding philosophy found in many other successful open-source projects. You just aren’t well-rooted (unless we’re discussing your security issues again–you’re well-rooted there. But I don’t want to harp on that again today).

I’ve said it before and I’ll say it again: you just aren’t very consistant; it’s hard really get to know you even when I think I understand you. Yes, I do understand your need to be everything to everyone, but that neediness has hurt you along the way. Why do you use underscores in “strip_tags” and “str_ replace” but not in “strlen” or “wordwrap”? And why do you like “ip2long”, but it’s “strtolower”? Don’t even get me started on how you’ve implemented OOP features. The lack of consistancy can be maddening when I’m trying to work with you.

I know, I know… you say that you’re changing and I should be patient. “The next version.” But I think we’ve all heard that before. Quite honestly, I think you have some deep-seated personal issues that need to be resolved first. The important people in your life keep abandoning you when you need them most. This isn’t something a shopping trip and make-over can cure. I’m not trying to be an asshole here, but I just don’t know if you can ever really change.

While I’m talking about personal failings here, I wanted to touch on your… “performance”. Yeah, yeah–most of the time it’s good enough. Sometimes though, I just need it faster. I know there’s a few things you can use to enhance your performance, like APC and Turck MMCache. But we shouldn’t have to use those things. It just adds to the overall complexity and makes the relationship harder to maintain.

I hope we can still be friends. I’m sure I’m going to still be seeing you around a lot and I don’t really have problems working with you. However, you just aren’t marriage material and I need to think about the future. That Ruby down the hall seems to be getting a lot of attention lately; I might flirt with her a bit. I also want to give Python another shake. Her lack of curly braces and semicolons is kinda weird, but she has a nice personality. Most importantly though, Python seems to really understand herself.


37 Replies to “Dear PHP, I think it’s time we broke up.”

  1. I have to agree with pretty much everything you say. I have been flirting with Ruby for months now, yet still going strong with PHP. Ruby keeps telling me to leave PHP and shack up with her, but I just don’t have the heart (not to mention the time to fully learn all about her).

  2. This is great – in the funny kind of way, and the too bad its true kind of way. I’m a fan of ASP .Net because of its OO code behind structure, but I’ve been wanting to play with Ruby. It’s shiny elegance is appealing.

  3. Python is totally hot for you. She said she diggs your writing. And when she wears that Django dress… man, I wish I wasn’t married to COBOL.

  4. That’s what you tell PHP but the real truth is more along the lines:

    Dear PHP,

    I think we should break up, while in my deepest of feeling I still love you, my friends keep telling me to break up with you and move on to something else. You have your flaws that you had when I fell in love with you and didn’t mind working with but now that my friends have pointed them out I can’t help but notice them and it has poisoned me. I’m pretty superficial that way so I don’t think it’s going to work on, and beleive me when I say, it’s not you, it’s me.

  5. I agree with Jared, nitpicking about an underscore?! And I haven’t felt a need for more speed personally but I’m now looking into those cache options, if they truly speed up, why not?

  6. PHP might be failing, but there is flaw in every system.
    for me, I stuck with something that I can use, until it is not good enough to do what I want.
    PHP is good enough for what it does, all the OO, MVC are just people expecting more out of something that is not designed for it.

  7. The thing is, if you need to use OO, and fancy patterns like MVC, php is not for you. If you want to deploy a quick website with an email contact form, then go with php, it will do it easily in 3 minutes.

    If you need a large application that should be developed by a team, and you want to take advantage of OO techniques to ease the process, then keep your eyes fixed on Rails (or maybe Django, though I’m not really aquainted with it).

    php is an excellent templating engine. You can look at YouTube’s example: they use python (django?) for their back end, and php to generate the whole frontend. And it’s surely one of the most trafficky sites around.

    What I know is that personally, I recognize the power of php in doing simple things. But for complex things… you could do them in php, but that doesn’t make it right.

    I mean, you could use php with gtk to develop desktop applications …. but how many examples do you see of that? 😉

  8. The underlaying machine called Zend is the real scam in this story, PHP is deliberatly cripled to run slow unless you pay an extortion fee, aka buying an accelerator.

    What PHP needs is a fork onto a GPL’d interperter machine and lots of bugfixes and codeslashing in the library.

  9. Great Article, you won a new feed subscriber 🙂

    PHP has many friends and I don’t wanna leave this circle. By using the right framework, many disadvantages disappear. And by the way, Ruby and Python Code really looks ugly..

  10. PHP is a rather complex lady, unfortunately most people look at her at a skin deep level and their she is easy to go along with, with occassional quirks, but when you to know her well, you suddenly realise she is a very complex woman.

    You then have to rip up the script and start thinking like a real programmer (yes bin the quiche!) and she can do all sorts of weird and often wonderful things.

  11. Same experience …
    i’ve started php in 97, and love it til 2003 …
    now, all my love goes to python … which is the next big thing in web development …
    see the beauty of WSGI … play with colubrid, simpleweb or the better (for me) webpy
    you can try mvc framework like django/turbogears … but i don’t like frameworks … and will prefer things like pylons/simpleweb for this kind of things …
    but you can couple a lot of “wsgi plugin”(they are already a lot !) and build your own/better framework, and choose some right good libs … and it will be the best framework !
    (it’s very very easy to do, and pluggable everywhere where wsgi does)

  12. The reason I wrote this post isn’t just to rant about what sucks in PHP; there are many, many other lists out there for that (and every other language for that matter).

    Almost every OSS community I’ve been involved with seems to have some sort of guiding philsophy behind it (Ubuntu and Python are the most obvious examples of this.) PHP just doesn’t seem to have that same unifying force. And I think that’s the source of the vast majority of its shortcomings. It’s not something that I could easily summarize with a bulleted list.

    The post started out as an explaination of why I was moving away from PHP, but the more I wrote, the more it felt like a “Dear John” letter;. so I just went with it.

    Thanks for reading and I appreciate the feedback!

  13. Why do people say PHP is not secure ?
    I mean whats the real reason behind it ?

    Can I blame Language “C” for flaws in deamons like BIND, SENDMAIL, ProFTPD ?

    Then how can we blame PHP for security lacks in some third-party scripts ?

    I’ve been using Ruby, Python, PHP, Java to same effectiveness(?) in web applications …
    my personal opinion is any language is good as long as it serves the purpose in required time and constraints from internal as well as external clients 🙂

  14. come on guys,I’m still starting mu relation with php this is dicouraging….
    I just bought the php black book struglling through the first chapter
    I couldn’t even install it I downloaded the triad from the net just have no idea why isn’t it working????????????//

    I’m going crazy any advice write me


  15. Someone said that Python and Ruby are ugly languages? Do you need glasses? PHP is a headache and a half to read. Both Python and Ruby are far more concise, and easy on the eyes. The main reason I couldn’t swallow PHP–when I was looking for a web dev language–was it’s complete lack of architecture (though I understand they have a variety of frameworks out now), and the hideous code it produces. Yuck. Ruby just worked more to my brains way of thinking. Python is nice too, just not the right fit for me that Ruby was.

    In my case, I think an extraordinarily powerful combination is Flex as a front-end, and Rails (Ruby) as the back-end. Best of both worlds.

  16. Reading the “letter” was amusing and I tend to agree with you.
    But most of the comments are alarming.
    To quote Nicolás Sanguinetti:
    “The thing is, if you need to use OO, and fancy patterns like MVC, php is not for you. If you want to deploy a quick website with an email contact form, then go with php, it will do it easily in 3 minutes.”
    Ok, he got it soooo right, the rest of his comment loses the plot a bit.
    But the rest of them – to sample a few worrying ones:
    “you can try mvc framework like django/turbogears … but i don’t like frameworks “
    WHAT??? Do you understand the difference between a website and a web application?

    “i’ve started php in 97, and love it til 2003 …
    now, all my love goes to python … which is the next big thing in web development “

    Dude, change the stuff you read, I’ve yet to meet anyone who thinks Python is the next big thing, it has been knocking around for years.

    Moral: Pick the right tool for the job, not just go along with what you know and hack it to fit the job.

  17. I “quit” PHP as my favourite language about a year ago. For me the most important argument was that PHP didn’t have the batteries included. Just get a date from the Database and you have to parse the string, in Python you get a Datetime-Object. Sure you can have all these things in PHP as well but you have to choose your libraries etc..

    Then, PHP is missing namespaces (in PHP5 you can work around this by having all code in classes).

    Another thing is the user community. I don’t like the PHP community very much. It seems like it consists of mainly teenage wannabe hackers.

    Your main argument seems to be that it has no character. I second that. It seems that many features are implemented without giving a deep thought: “Let’s take OO from java, that’s what everyone knows already”. I don’t see many unique design ideas in PHP.

    But, ah well, PHP is still very very easy to use: Rename your index.html to index.php and put your code into the page. You don’t have that with Python or Ruby. So for beginners, PHP surely stays the language of choice.

  18. I believe that PHP became so popular because of everyones attitude towards her, they really fell badly in love with her, because she is so flexible and robust. Whenever I was in need of simple solution to a complex problem she was there to save the day.
    She is just getting better and better with every version, I think soon she’ll be the perfect lady for my. She has always been someone I could rely on, and she never asked for much. I could take her anywhere, windows, linux, macoss and she never complained.

    When ever I though she could not solve a problem, there she was with a library or a api ready to roll out. You are a true genius, a breed apart from all these other OSS wannabes

    I love you PHP

  19. I’m also preparing to move from PHP to something else. Part of it is the ugliness of PHP, but a bigger part is the difficulty in debugging PHP.

    A site that I wrote a few months ago stopped working recently, perhaps because the site administrators did an upgrade (in the 4.x stream). My guess is that my code was faulty (I often forget to wrap code in isset() conditionals) from the start, but that the older version worked despite the error.

    I eventually found that the problem was in overwriting variables by parse_str(), The problem went away if I added a second parameter to that function, even if I didn’t use it. This sort of thing does not inspire confidence in one’s code or the suitability of the language for use by a mediocre coder like myself. (And, yes, PHP is clearly used by a lot of mediocre coders; this is because hello-world coding is so easy in PHP.)

    So, where to turn? I’ve been looking at Ruby on Rails and at Django. Each appeals, neither breathtakingly.
    I think scaffold-based Rails may be the winner for complicated web applications, while template-based Django may suite information-listing sites. Probably the nature of the site creation also comes into play; the template language of Django is appealing since it can let a non-coders set up the look of the site.

    Django is not at a release point yet, so a worry with it is that code might have to be rewritten in a few months.

    A strong negative to both Rails and Django is that the web server will have to be altered. On all the systems I use, PHP comes pre-installed. That’s not true for either Rails or Django. On my own systems, I’ll have to do a lot of (uninteresting) work to set up the appropriate modules. On other systems, I’m simply SOL; the manager of my 50-user system won’t do that (and, as his employer, I don’t want him spending time on that), and the managers of the broader 15,000-user system won’t (and probably shouldn’t) use time on such things.

    The sad thing is that ease of use got people into PHP, and ease of deployment will likely keep a lot of people using it long after they would rather have moved on.

    Sorry, no romantic analogies here, unless you count “moving on”.

  20. Sorry to be so blunt: but frankly I have no idea what you’re bickering about. PHP has no performance issues in the hands of a good programmer. Sorry, I’ll apologize again for being blunt! I’ve run sites off PHP that generate more than 25000 unique visitors a day and it’s constantly bashing on PHP and MySQL. You know what? The server sniffs at this and the performance is about as a good as I’ve seen compared to anything else: ASP, Cold Fusion,. NET, and I’ve programmed in them all. So what the functions are named a bit inconsistent. Don’t tell me there’s any langauge that doesn’t have these same types of quirks because I will call that.

    We’ll see where Ruby and Python end up. I’m guessing in their evolution people will start complaining about them too.

    Bottom line: PHP is a fantastic and inexpensive langauge that doesn’t just about as well as any other much more costly solution.

  21. i couldn’t read the whole 18 pages (front and back!!) but if performance is the reason you’re breaking up with php then better switch to mod_perl this time.. sure it looks like that its on steroids on occasion but it’ll blazing performance will always keep you satisfied and smiling

  22. It’s interesting that you complain about having to use a code cache like APC in order to get better speed from PHP. Perl and Python both have something like this built in, while Ruby does not. This is why Perl, Python, and PHP+APC are all much faster than Ruby. Compiling to some kind of intermediary bytecode the way that these other languages do is listed as a possible future enhancement on Ruby’s Wikipedia page. It will probably not be as fast as PHP until that happens.

  23. I played with PHP since 2002, and end it at 2005… Yes i m concerned about my future. She helped me build applications but there is a certain limit a cannot break… that is to build an enterprise application. I found my heartbeat at Java…

  24. I’m agree with you, php is ugly, it’s time we broke up, but I think that good programming is indipendent from the language that you choose. If you’ve got the freedom to choice the language to use for work, you are a lucky one. If you work for an employer that choose php for developing huge enterprise applications, you’re not very lucky. You could use a framework, or write your own, and you’ll develop php applications with less pain.

  25. I’m starting to get really tired of all of the negativity online lately attacking PHP, especially on Slashdot. It all smells of FUD, and I’m sorry to see another blogger fall to this current trend…

    Meanwhile I will continue to do serious, OO and design pattern-based work in PHP, designing enterprise (whatever the hell that means 😉 applications and robust frameworks while others continue to claim that this is not possible in PHP. *sigh*.

  26. A really nice and amusing one 🙂 It doesn’t really matter whether you switch to Python, Ruby or Turbo pascal ( 🙂 ) – that’s just the way YOU want it – we live in a free world, after all and I don’t mind posts like this one.
    ” We few, we happy few, we band of PHPers;
    For he to-day that writes his code with me
    Shall be my brother; be he ne’er so vile,
    This day shall gentle his condition:
    And gentlemen over the world using Python
    Shall think themselves accursed they are not here,
    And hold their manhoods cheap whiles any speaks
    That wrote with us upon Saint PHP’s day. “

  27. if the code sucks, it’s no one’s fault but the author. I’ve coded in numerous languages and can tell you all that they ALL have limitations/short comings. To use the girlfriend analogy, no one is perfect. Accept that fact.

  28. PHP is a scripting language. Python is a programming language. Sometimes you just have needs that your ex-lover can never provide.

    Thankfully I started with Python and don’t plan on ever touching PHP.

Comments are closed.