Slashdot Mirror


The PHP Singularity

An anonymous reader writes "Jeff Atwood at Coding Horror has a post about the awfulness of PHP — or, rather, a post about posts about the awfulness of PHP. He points out that PHP has been the whipping boy for the developer community for years, and while everybody seems happy to complain about it, nobody seems willing to do anything about it. He writes, 'From my perspective, the point of all these "PHP is broken" rants is not just to complain, but to help educate and potentially warn off new coders starting new codebases. Some fine, even historic work has been done in PHP despite the madness, unquestionably. But now we need to work together to fix what is broken. The best way to fix the PHP problem at this point is to make the alternatives so outstanding that the choice of the better hammer becomes obvious.'"

622 comments

  1. Recursive? by Anonymous Coward · · Score: 5, Funny

    And now, a post about a post about posts about the awfulness of PHP.

    Which would make these comments posts about a post about a post about posts about the awfulness of PHP.

    ---
    Recursion: First you curse, then you curse again.

    1. Re:Recursive? by Anonymous Coward · · Score: 1

      PHP itself is an acronym for PHP: Hypertext Preprocessor.. But then what does "PHP" stand for?

      Don't give me turtles!

    2. Re:Recursive? by arth1 · · Score: 5, Informative

      PHP itself is an acronym for PHP: Hypertext Preprocessor.. But then what does "PHP" stand for?

      It's an old joke, already trite by the time PHP came out.

      GNU = GNU is Not Unix
      Wine = Wine Is Not an Emulator
      PNG = PNG is Not Gif (later backronymed to Portable Network Graphics)
      LAME = LAME Ain't an MP3 Encoder
      VISA = VISA International Service Association

    3. Re:Recursive? by Anonymous Coward · · Score: 0

      And now, a post about a post about posts about the awfulness of PHP.

      Which would make these comments posts about a post about a post about posts about the awfulness of PHP.

      ---
      Recursion: First you curse, then you curse again.

      Love the comment, hate the article... although, I'd have the challenge how it's an article.

    4. Re:Recursive? by ChunderDownunder · · Score: 2

      Don't give me turtles!

      No, silly, ElePHPants.

    5. Re:Recursive? by toastar · · Score: 1

      Personal Home Page

    6. Re:Recursive? by bruce_the_loon · · Score: 5, Informative

      PHP was originally Personal Home Page Toolkit, then backronymed into the new meaning.

      --
      Trying to become famous by taking photos. Visit my homepage please.
    7. Re:Recursive? by Anonymous Coward · · Score: 1

      So then by corollary, it's: Personal Home Page: Hypertext Preprocessor

    8. Re:Recursive? by PenquinCoder · · Score: 1

      Pretty Home Page

    9. Re:Recursive? by datavirtue · · Score: 4, Funny

      yo dawg.

      --
      I object to power without constructive purpose. --Spock
    10. Re:Recursive? by Anonymous Coward · · Score: 0

      So then by corollary, it's: Personal Home Page: Hypertext Preprocessor

      Incorrect.

      Correct: PHP: Hypertext Preprocessor Hypertext Preprocessor.

    11. Re:Recursive? by Anonymous Coward · · Score: 5, Funny

      BING = BING is not Google.

    12. Re:Recursive? by Rhaban · · Score: 1

      People Hate PERL

    13. Re:Recursive? by ArundelCastle · · Score: 1

      PHP itself is an acronym for PHP: Hypertext Preprocessor..

      Hm, for some reason I had "Pre-Hypertext Processor" in my head. I must've seen or heard it somewhere.

      (And now YOU have too, haha!)

    14. Re:Recursive? by mr.mctibbs · · Score: 1

      It's called a "recursive acronym."

    15. Re:Recursive? by DdJ · · Score: 2

      Yeah, when I started using it (back before PHP 3.0), it was actually called "PHP/FI", which stood for "personal home page / forms interface".

    16. Re:Recursive? by Anonymous Coward · · Score: 0

      And vagina.

    17. Re:Recursive? by Anonymous Coward · · Score: 0

      BING = BING is not Google.

      But it's not Google. Common mistake ;)

    18. Re:Recursive? by Jorl17 · · Score: 2

      Wine was originally WINdows Emulator, but they changed it for at least two obvious reasons.

      --
      Have you heard about SoylentNews?
    19. Re:Recursive? by dhalgren · · Score: 1

      Minor correction: "interpreter", not "interface".

    20. Re:Recursive? by allo · · Score: 1

      no, it started as "personal home page", but just like the KDE project, they settled for a more serious interpretation of the chars.

    21. Re:Recursive? by Chrisq · · Score: 1

      And now, a post about a post about posts about the awfulness of PHP.

      Which would make these comments posts about a post about a post about posts about the awfulness of PHP.

      --- Recursion: First you curse, then you curse again.

      I might post about that

    22. Re:Recursive? by Anonymous Coward · · Score: 0

      Pine = Pine Is Not Elm (both old fullscreen terminal mail readers from the early/mid 90s, now if you excuse me I have to go find an onion to tie to my belt...

    23. Re:Recursive? by Alioth · · Score: 0

      I thought PHP was an abbreviation of Pretty Hopeless Privacy.

    24. Re:Recursive? by multicoregeneral · · Score: 2

      Can you blame them?

      --
      This signature intentionally left blank.
    25. Re:Recursive? by vjoel · · Score: 0

      PHP itself is an acronym for PHP: Hypertext Preprocessor.. But then what does "PHP" stand for?

      Programmers Hate PHP.

      --
      What part of `yes no` don't you understand?
    26. Re:Recursive? by julesh · · Score: 1

      Wine was originally WINdows Emulator, but they changed it for at least two obvious reasons.

      One of which hinges on a misunderstanding of the meaning of the word "emulator"

    27. Re:Recursive? by Anonymous Coward · · Score: 0

      It isn't?

    28. Re:Recursive? by Jorl17 · · Score: 1

      Exactly.

      --
      Have you heard about SoylentNews?
    29. Re:Recursive? by Anonymous Coward · · Score: 0

      I always liked PERL being "Pathologically Eclectic Rubbish Lister" rather than "Practical Extraction and Reporting Language"

      LOL....Captcha is "useful"

    30. Re:Recursive? by Concerned+Onlooker · · Score: 1

      A Perl onion, no doubt.

      --
      http://www.rootstrikers.org/
    31. Re:Recursive? by ignavus · · Score: 1

      BING = BING is not Google.

      And here was I thinking it meant "BING Is No Good".

      --
      I am anarch of all I survey.
    32. Re:Recursive? by Anonymous Coward · · Score: 0

      Please, don't remind me that the way the general public is learning about recursion is through rappers and internet memes.

    33. Re:Recursive? by arth1 · · Score: 1

      I always liked PERL being "Pathologically Eclectic Rubbish Lister" rather than "Practical Extraction and Reporting Language"

      Neither is a self-referencing acronym, so why bring it up? "Whoosh"?

    34. Re:Recursive? by cthulhu11 · · Score: 1

      Probably not many of you encountered this one back in the mid-80's: MINCE Is Not Complete EMACS and brother, it sure wasn't.

    35. Re:Recursive? by Tore+S+B · · Score: 1

      Or my favorite:
      EINE - EINE Is Not EMACS
      ZWEI - ZWEI Was Eine Initially

      --
      toresbe
    36. Re:Recursive? by ShieldW0lf · · Score: 1

      BING = BING is not Google.

      Thanks... now everyone within earshot knows I was on here instead of working...

      --
      -1 Uncomfortable Truth
  2. Really? by Anonymous Coward · · Score: 4, Insightful

    What kind of bullshit logic is that? Something is broken, everyone hates it, so let's put all our efforts in making the alternatives better? How about contributing to PHP and fixing what you're bitching about instead of, well, bitching about it? You know, it's open-source and all.

    1. Re:Really? by Anonymous Coward · · Score: 4, Insightful

      The problem lies at its core. You can't fix people.

    2. Re:Really? by Richard_at_work · · Score: 4, Informative

      PHP is well beyond fixing - mysql_escape_string and mysql_real_escape_string prove it, otherwise the first method would have been fixed rather than "replaced".

      The best you can hope for these days is overlaying a framework.

    3. Re:Really? by mfarah · · Score: 5, Interesting

      What kind of bullshit logic is that? Something is broken, everyone hates it, so let's put all our efforts in making the alternatives better? How about contributing to PHP and fixing what you're bitching about instead of, well, bitching about it? You know, it's open-source and all.

      An important part of fixing something is being able to recognize when it's better to throw it away and build it again. PHP has so many problems, in each layer down to the bottom, it's way past the "We can fix it if we apply ourselves": it's better to throw it away and build it again. Something like a new scripting language called PDR ("PHP Done Right").

      --
      "Trust me - I know what I'm doing."
      - Sledge Hammer
    4. Re:Really? by JDG1980 · · Score: 3, Informative

      PHP is well beyond fixing - mysql_escape_string and mysql_real_escape_string prove it, otherwise the first method would have been fixed rather than "replaced".

      They had to do it this way for backward compatibility. If they changed the way it works, then any program that relied on the existing (buggy) behavior would break as a result.

    5. Re:Really? by MightyMartian · · Score: 4, Insightful

      Indeed. For years now it's been patiently explained over and over and over again what needs to be fixed, and the core team just keeps perpetuating the same crappy nonsense. Since there are other perfectly good languages out there, I see no point in anyone, say, forking PHP.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    6. Re:Really? by Anonymous Coward · · Score: 0

      Wow. Every time someone says PHP isn't that bad, I am going to send them that link.

      Amazing.

    7. Re:Really? by Ghostworks · · Score: 2

      What kind of bullshit logic is that? Something is broken, everyone hates it, so let's put all our efforts in making the alternatives better? How about contributing to PHP and fixing what you're bitching about instead of, well, bitching about it? You know, it's open-source and all.

      The unspoken argument here is that the complainers are no longer trying to contribute to PHP by providing feedback. Rather, they have determined that PHP is fundamentally terrible at doing the work it's been recruited to do. Fixing it to be "the best possible wrong tool for the job" would not be productive.

      Because it looks like it should work, you don't have the benefit of understanding that it doesn't until you've wasted your time using it and have probably committed a good deal of your project to it trying to make it work. Hence, most people using it today are less concerned with improving future iterations than they are with killing the damn thing by warning people away from it. Because if nobody uses it, nobody has to support it.

      If this still sounds peculiar to you, remember this is pretty much exactly what happened to kick off the second browser wars. IE sucked, people complained constantly, Microsoft did nothing (because why would they?), and eventually enough talented people were fed up to get the old Mozilla code up to speed.

    8. Re:Really? by MightyMartian · · Score: 1

      Yup, apart from all the other absurdities, PHP's library just plain sucks. Inconsistent with loads of functionality duplication. I realize that a lot of this baggage is due to backwards compatibility, but the time has come to toss the cruft, come up with a new library.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    9. Re:Really? by Anonymous Coward · · Score: 4, Insightful

      If I announce that I'm going to try to cross the Atlantic in an inflatable dinghy, there are two possible responses which a reasonable observer could have:

      1. Tell me I am an idiot and going to kill myself, and to use a proper boat instead, of which many excellent designs are readily available.
      2. Help me design and build the world's most awesome rubber dinghy, which, in the end, is still a rubber dinghy and still probably going to get me killed.

    10. Re:Really? by Richard_at_work · · Score: 4, Insightful

      That's what major version bumps are for. Make it a breaking change, rather than make it something that festers in the codebase forever. If the method is broken, then the solution is not to let apps continue to use it.

      Make it a breaking change, bump the major version up, force people to upgrade through obsolescence and we would be in a much better situation.

    11. Re:Really? by Anonymous Coward · · Score: 0

      1999 called. They want their library collection back.

      PDO has been standard in PHP for ages.

      Same crap every time there's a post about MySQL or PHP. So-called "experts" stuck in 1999 (the year of the Linux desktop!) that can't change, or accept that something has changed.

    12. Re:Really? by Richard_at_work · · Score: 3, Insightful

      From what I've heard, that's pretty much what Facebook did - start off with PHP and eventually evolved their own language from it.

    13. Re:Really? by billcopc · · Score: 5, Insightful

      The problem with "fixing" PHP is it breaks compatibility with existing code. Not all of it, but a lot of it, because it was either written by complete imbeciles who just happened to get lucky, or brilliant coders who worked around PHP's perversions.

      I'd like to think I fit in the latter category. I actually really like PHP because it's so dumb and open-ended, it lets me code whatever the hell I want without forcing much functional-programming hipster crap down my throat (I'm staring at you: Python/Ruby/Haskell/Scala/Clojure).

      Yes, it's messy, and yes, it could greatly benefit from a concerted cleanup effort, but given it's install base and the mind-numbing amount of public code in use, it's hard to justify the pain in fixing all that stuff. Just think of the tens of millions of sites running some spinoff of PhpBB, the countless MediaWikis, nearly every torrent tracker, and all those pages of horrible code written by the aforementioned imbeciles. That's a lot of pain to satisfy a few pedants. Clearly, PHP works "well enough" for most of us.

      That said, nothing's stopping people from forking it, fixing that code, and releasing it as something new. If it's better than PHP and helps me land paying work, or make my own projects easier to develop and maintain, I'll happily use it. Ah, but that would require these people to stop posting inflammatory linkbait on their canned Wordpress blogs and actually practice what they preach...

      --
      -Billco, Fnarg.com
    14. Re:Really? by Anonymous Coward · · Score: 1

      i read the whole bug and i'm not sure i understand your point.

      person A was being paid to do a job. he failed to keep an eye on his job for a year whilst the RC was available. he then tried to get person B to fix things.

      person B wasn't being paid at all, suggested a workaround, explained why it was too late to complain and was the creator of PHP... PHP being the language person A decided to build his company on.

      what's the problem?

    15. Re:Really? by beelsebob · · Score: 3, Interesting

      Because no amount of polishing turd will make it into gold. PHP has some fundamentally wrong assumptions in its design, you can't fix it without just making it something that isn't PHP.

    16. Re:Really? by ThePhilips · · Score: 1

      Fork?

      --
      All hope abandon ye who enter here.
    17. Re:Really? by Anonymous Coward · · Score: 0

      And then you have people like this who complain when they make breaking changes between major versions. It's lose-lose.

    18. Re:Really? by SolitaryMan · · Score: 1

      The GP point still stands. Somehow other projects deal with this and nobody dies.

      --
      May Peace Prevail On Earth
    19. Re:Really? by Anonymous Coward · · Score: 0

      And? Isn't it the job of the programmer to fix that? Like with pretty much any other API?

    20. Re:Really? by Java+Pimp · · Score: 4, Insightful

      I don't know. It looks like some guy has code that sends uninitialized or null values which to me would invoke undefined behavior and is then bitching about when that behavior changes.

      From the thread: We are passing a (possibly uninitialized, or null-valued) variable to the function, in hundreds of places

      Sounds to me like this guy has other issues he should be worrying about.

      --
      Ascalante: Your bride is over 3,000 years old.
      Kull: She told me she was 19!
    21. Re:Really? by Anonymous Coward · · Score: 5, Insightful

      Poor example. Someone goes bananas when incorrect and inconsistant behaviour ( returning a number from a number formatting function when passed something that is not a number) is changed to correct behaviour consistent with the rest of php core (returning something that is not a number), after months of pre-releases and 'this is going to break buggy code' announcements, after everybody else has fixed their buggy code, and starts name calling, rather than:
      a) fixing their own buggy code or
      b) not upgrading the minor version on affected systems until their code is fixed

      This looks like a problem with the submitter, not the PHP team.

    22. Re:Really? by knuthin · · Score: 1

      That would cause isolating the already established user base.

      Like when you consider mysql_escape_string vs mysql_real_escape_string

      Also camel case vs underscores in function names. I am no big fan of Java, but having consistency between class name cases and function name cases helps a lot, in a way that you can just "guess" a function name. If you change all of those right now, the already written PHP code will be such a big mess.

      Though something like Python did with utility 2to3 could actually be used in the next PHP major release, but I suppose they are too cocky to bring about that change.

      --
      Some apps are WYSIWYG. Some others are WYSIWTF.
    23. Re:Really? by knuthin · · Score: 1

      I just wrote a reply to the parent, refreshed the page, and saw you had already mentioned "mysql_escape_string and mysql_real_escape_string". Looks like everyone hates it :P

      --
      Some apps are WYSIWYG. Some others are WYSIWTF.
    24. Re:Really? by jythie · · Score: 5, Insightful

      Actually, I would put the fault on the complainer here....

      Yeah, it sucks when languages and APIs change, but it happens and if one is going to be upgrading one should take such things as a given. This is why, when you have an environment where consistency is important, language and library upgrades are big deals that are scheduled with time allocated them.. otherwise freeze your versions unless there is a compelling reason with significant measurable benefit to upgrading... crow, I still keep VMs around in case I need to go back and work with earlier checkouts with known dependencies/versions.

    25. Re:Really? by wkcole · · Score: 2

      Why contribute to a project that has such a solid record of recklessly incompetent leadership? Why work to prop up an ecosystem that has developed into a vast toxic swamp?

      The advantages of PHP have always been reducible to the fact that it is relatively easy for non-programmers to understand. It's accessible for people who don't have a mindset for or interest in computer science. That's not inherently a bad thing, but it is risky. As with VB before it, it is true that any crazy idiot can code in PHP, so many of them do. The choices made over the years by many in the PHP community (led from the top) to keep it an easy, accessible, and forgiving platform in order to grow rather than improve the community have had predictable results. The debacle of the recent release bungles and the ongoing failure to either obviate Suhosin for 5.4.x or make it work is demonstrative evidence that the guiding spirit of the PHP universe is still one of reckless incompetence.

    26. Re:Really? by tepples · · Score: 0

      So I gather the right way to do it is to upgrade the minor version and the buggy code at the same time. In that case, how does one upgrade the minor version without having to pay the early termination fee on one's contract with the web hosting provider? And how does one run applications that require different minor versions?

    27. Re:Really? by SolitaryMan · · Score: 4, Insightful

      I honestly don't see how this demonstrates any problem with PHP people.

      The guy was using some function in what appears to me as the wrong way (failed to validate inputs) and was relying on some edge-case behaviour. Now this edge-case behaviour has changed and made the mistake in his code more apparent.

      I hate PHP and try to avoid it like plague, but this guy got what he was asking for.

      --
      May Peace Prevail On Earth
    28. Re:Really? by Richard_at_work · · Score: 1

      PDO might be standard, but there is a huge install of legacy codebases out there which don't use it.

    29. Re:Really? by fluffythedestroyer · · Score: 1

      I would get 100% troll post with what you just said... everyone hates me :(

    30. Re:Really? by billcopc · · Score: 1

      Agreed that PHP needs a major cleanup, but the resultant product probably shouldn't be called PHP 6. While we techies understand that a major version bump can break backward compatibility, explaining that to management types is an exercise in futility. They will state that the I.T. lab must continue using the old, unsupported version and not spend a dime rewriting any deprecated code. These would be the same management types who are still using IE6 because they can't let go of their decade-old million-dollar piece of shit CRM whose developer smartly closed up shop before the maintenance contract kicked in.

      Fork it, have a nasty legacy PHP to support the existing codebase, and a separate, cleaned up PHP-derivative for everyone else. I'd use it in a heartbeat, because I actually like PHP for the most part. I use it for all sorts of scripting, not just web stuff, kind of like a more string-friendly Perl.

      --
      -Billco, Fnarg.com
    31. Re:Really? by Charliemopps · · Score: 2

      0 is not NULL.
      Period.
      It's a bug, the submitter is correct.

    32. Re:Really? by SQL+Error · · Score: 0

      We already have fixed versions of PHP the language. They're called Python and Ruby.

      We just need to work on the deployment.

    33. Re:Really? by _xeno_ · · Score: 3, Insightful

      The guy was using some function in what appears to me as the wrong way (failed to validate inputs) and was relying on some edge-case behaviour. Now this edge-case behaviour has changed and made the mistake in his code more apparent.

      One of the things I hate about PHP was the number of times that calling a function with bad data "just works" even though it really shouldn't. (Primarily because it effectively dumps the checking onto you.) That looks like a perfect example - if you try and format a thing that isn't a number, it "works" and returns 0. Huh? That's not right. That should be an error.

      And now, it is! It notices the error, and returns NULL instead of pretending that a string is a number. Great!

      Someone elsewhere in this thread was complaining about mysql_escape_string and mysql_real_escape_string, and how they should have just fixed mysql_escape_string. It sounds like the person filing the bug report would have rather they created a real_number_format function rather than fix a bug in the existing number_format function.

      --
      You are in a maze of twisty little relative jumps, all alike.
    34. Re:Really? by Anonymous Coward · · Score: 0

      Your example of PHP being broken is about a depricated MySQL extension designed for PHP 4. Anyone that isn't a newbie is using either PDO or MySQLi. Maybe you should keep your comments to things you're actually an expert on instead of judging an entire language by the one wordpress blog you maintain.

      Oh snap!

    35. Re:Really? by Anonymous Coward · · Score: 0

      Actually, I think there's only one really underlying problem which is to do with the way PHP does dynamic casting. Notably:
        * String zero "0" evaluates to false (even though it's not an empty string)
        * "01234....4" == "01234....5" (two long strings which happen to be numeric will get cast to float before comparison and may be equal when they aren't).

      The solution would be simple: PHP should never automatically cast strings to numbers. (The other way is always ok). So, in PHP6, I'd introduce the following changes:

        * Type juggling works as currently, except that:
                - strings are never cast to numbers, without the explicit use of a function, perhaps (for brevity), n($string)
              - [the other casts are safe, useful and convenient, eg: $x=42; echo "The answer is $x"; (Python makes this far more verbose, needlessly) ]

      * Support some of the nicest Python features:
              - lists, and the "in" operator eg " If $fruit in ('apples', 'oranges')
              - functions that return tuples
              - keyword arguments to functions.

      * Add a database feature that lets the database return correctly typed variables. (for example, postgres returns 't' and 'f' instead of true/false).

      As for functions returning different types, I personally like this. For example, strpos() can return 0 meaning "found it at position 0" and false to mean "not found".
      This is a useful feature for the expert (albeit a trap for the novice). [For consistency, let's fix the preg_ functions which, when they fail, return NULL rather than false.]

    36. Re:Really? by Anonymous Coward · · Score: 0

      All that thread demonstrated was that people that use PHP are poor programmers that rely on bugs in the language to do things. That is, they don't have a fundamental understanding of the language. The guy arguing with rasmus on that thread is the kind of guy that assumes an int in C is 32 bits and bitches when his code doesn't port to another platform.

    37. Re:Really? by Anonymous Coward · · Score: 0

      > what's the problem?

      PHP's standard library is full of weird bugs and inconsistencies that will constantly bite you in the ass. The fact that the creator of PHP doesn't care is almost besides the point.

    38. Re:Really? by Anonymous Coward · · Score: 1

      Why in the world would a number formatter return 0 when something other than a number was passed to it? Null seems appropriate to me.

    39. Re:Really? by Anonymous Coward · · Score: 0

      PDO has been standard in PHP for ages.

      And it's pronounced "PEE-dough."

    40. Re:Really? by Qzukk · · Score: 1

      otherwise the first method would have been fixed rather than "replaced".

      That is directly from the mysql API. http://dev.mysql.com/doc/refman/5.0/en/mysql-real-escape-string.html

      Make of it what you will.

      --
      If I have been able to see further than others, it is because I bought a pair of binoculars.
    41. Re:Really? by Java+Pimp · · Score: 1, Informative

      If the submitter is doing anything with uninitialized variables he doesn't have any room to complain about other people's code.

      --
      Ascalante: Your bride is over 3,000 years old.
      Kull: She told me she was 19!
    42. Re:Really? by Anonymous Coward · · Score: 1

      mysql_* is actually depreciated in modern PHP.

      However most web tutorials still show newbie programmers how to use it; and even worse the example code is often sql injection-prone. At least half the problem with PHP is the "it works, so I don't give a fuck" culture.

    43. Re:Really? by knuthin · · Score: 1

      Agreed that PHP needs a major cleanup, but the resultant product probably shouldn't be called PHP 6.

      I am thinking more on the lines of having the legacy support you mentioned below and have something like Linux aliases (clean standardized functions that eventually call the murky functions). By this time, try getting all the murky insider functions to follow the standards and have a release even later (5 - 6 years) that standardizes all the functions.

      Like when compared with Python, Python 2.7 runs both 2 and 3 codes equally well. It's like a transition release.

      I am saying that because think of all the posts regarding PHP, questions asked about it on forums, sites devoted solely to it, and all the SEO shit around it. That'd be hard to replace for a replacement language.

      I use it for all sorts of scripting, not just web stuff, kind of like a more string-friendly Perl.

      I knew an admin who'd work on PHP for doing his server maintenance. He hated PHP on web based applications. You kinda remind me of him.

      --
      Some apps are WYSIWYG. Some others are WYSIWTF.
    44. Re:Really? by PCM2 · · Score: 2

      The advantages of PHP have always been reducible to the fact that it is relatively easy for non-programmers to understand.

      I would add that it's widely available. Pretty much any $4/month hosting plan is going to have PHP available. I'll warrant that this has caused some people to use PHP for Web sites when they might not otherwise have done so.

      --
      Breakfast served all day!
    45. Re:Really? by radiumsoup · · Score: 1

      AC seems to be the one who submitted the bug and is looking for validation for his complaint from /. readers.

    46. Re:Really? by Anonymous Coward · · Score: 5, Insightful

      But that's a valid fix. PHP has been enforcing basic type constraints on internal functions for years. And before that it was throwing up E_STRICT warnigns (that people ignored).
      So now that these strict warnings are causing issues because of bad coding practices. You should -always- know what type your variable should be in a context -- saying "it could be an empty string, null, uninitialized, or a number" means you have more serious issues in your program logic to address.

    47. Re:Really? by Anonymous Coward · · Score: 0

      Someone down mod this fucking fagget until he grows a skin. Your slashdot nerd score doesn't matter, kid. Close your account and post things like this. Your post I'm replying to isn't much more insightful.

      I've got karma to burn, so mod me up.

    48. Re:Really? by mwvdlee · · Score: 1

      Indeed. Creating bad code, then complaining about the language developers fixing the obvious bug you were abusing... PHP is doomed.

      I can't imagine the stupidity of somebody writing print number_format("",0); and not realising that it returning 0 instead of null is atleast a bit suspicious, in fact making heavy use of this obviously behaviour.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    49. Re:Really? by omnichad · · Score: 5, Insightful

      No, 0 is not NULL. But "" cast as an INT could be considered NULL. It's not an INT. The parameter of 0 means 0 digits after the decimal. Why they don't just round or floor/ceil instead, I don't know. But first things first - you need to pass in a number to format a number.

    50. Re:Really? by shadowrat · · Score: 1

      I took it more as a wrong tool for the job argument. I don't know much about PHP so i'll use another scenario to illustrate my point. We all know that person who will use excel for everything. Excel is fine and you can make it do an awful lot of stuff, but at some point you need to accept that it's never going to be as good as a drawing program for producing images. The solution shouldn't be to make excel a better drawing program.

    51. Re:Really? by 228e2 · · Score: 5, Insightful

      Because that what they say they will return. Regardless if you pass in unchecked arguments.

      How can you properly debug code if documented fuctions dont behave in the way documented and acts inconsistantly??

      --
      Since when does being a Socialist mean 'someone who has a different opinion than me'?
    52. Re:Really? by Anonymous Coward · · Score: 1

      But it wasn't "supposed to default to 0" -- that implies a design document specifying said default existed at some point. In fact, it was just a pile of adhocery that previously happened to default to 0. When your project is a pile of adhocery, people who use it anyway have no right to complain when you change your mind.

    53. Re:Really? by Qzukk · · Score: 3, Insightful

      This is the real solution, because let's face it: not everyone needs a java instance running with -MmmXxWTFBBQMemory 500000000 and 60000 classes to run a forum. People use PHP when they neither need nor want "application servers", they want it to just work.

      Make a mod_pdr (or at least a fastcgi-compatible script executor where nobody has to implement the fastcgi protocol by hand for every single script like python or ruby), and you'll have the attention of the hosting people. They don't want to have to babysit 50000 different users' rails or tomcat instances, so they don't offer them.

      --
      If I have been able to see further than others, it is because I bought a pair of binoculars.
    54. Re:Really? by Anonymous Coward · · Score: 0

      Person B lacks DHH's ability to say "Deal with it".

    55. Re:Really? by hazah · · Score: 1

      So many 'a' s. I think I'll stop now.

    56. Re:Really? by eddy+the+lip · · Score: 2

      We already have fixed versions of PHP the language. They're called Python and Ruby.

      We just need to work on the deployment.

      This is exactly it. I write nearly all my code in PHP, and it is not for a love of the language. I switched to PHP from perl (after taking a good, long (and longing) look at python) for two simple reasons:

      • * it was deployed everywhere
      • * enough of the basics were included that I didn't need to worry about whether a database library would be on the server, or some form of image manipulation, etc. There is too much crap in PHP, but at least I don't have to spend weeks convincing some sysadmin that, yes, I really do need to query a db, and would you please compile the extension?

      It pains me to no end that my bread and butter is made with a language I don't particularly care for, but in the end, I can at least get things done with it.

      --

      This is the voice of World Control. I bring you Peace.

    57. Re:Really? by hchaos · · Score: 1

      What kind of bullshit logic is that? Something is broken, everyone hates it, so let's put all our efforts in making the alternatives better? How about contributing to PHP and fixing what you're bitching about instead of, well, bitching about it? You know, it's open-source and all.

      Speaking of bullshit logic, why should I contribute to a language that I hate, instead of doing something useful in a language that I actually like?

    58. Re:Really? by discord5 · · Score: 1

      How about contributing to PHP and fixing what you're bitching about instead of, well, bitching about it?

      A polished turd is still a turd.

      Sorry if that insults your language of choice...

    59. Re:Really? by mwvdlee · · Score: 1

      Don't use the mysql_* set of functions. There's mysqli_ if you want an easy upgrade (anybody that picks mysql_* over mysqli_* should be fired) or PDO if you want a better solution altogether. And shitloads of frameworks to handle MySQL for you.

      PHP has many crappy functions, certainly more so than most languages, but it also has a lot of alternatives that allow you to ignore the crap. In PHP5.x, you can do a lot of stuff using objects, but PHP documentation seems to hide the good stuff for some reason.

      PHP certainly would be better if those function libraries could be included/imported, then it would be easier to deprecate the bad and improve the good.
      Language like C#, Java and C++ also had plenty of really bad functions. In atleast Java and C++ you still pay for some of those early mistakes, but atleast they've deprecated most of it, so you are encouraged to use the better alternatives. Perhaps PHP's biggest mistake is to allow people to continue using stuff they should be smart enough not to.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    60. Re:Really? by VGPowerlord · · Score: 1

      PHP is well beyond fixing - mysql_escape_string and mysql_real_escape_string prove it, otherwise the first method would have been fixed rather than "replaced".

      How would they fix that? The latter requires an active database connection and the former doesn't. Just changing the former would break any apps that relied on its old behavior.

      It's a moot point now, you should be using PDO for database connections in PHP... I haven't used PHP on a regular basis since 2006 and even I know that!

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    61. Re:Really? by Anonymous Coward · · Score: 0

      Actually, I hope that is what he meant...

      You can't fix the users.

    62. Re:Really? by discord5 · · Score: 1

      If they changed the way it works, then any program that relied on the existing (buggy) behavior would break as a result.

      Surely you can deprecate a function after all those years. I mean they've broken code before between major versions... It's just unwillingness not to do so at this point.

    63. Re:Really? by Cow+Jones · · Score: 2

      Actually, I would put the fault on the complainer here....

      So would I.
      I especially like how he asked Rasmus Lerdorf to "escalate this bug to someone"...

      CJ

      --

      Ah, arrogance and stupidity, all in the same package. How efficient of you. -- Londo Mollari
    64. Re:Really? by iamgnat · · Score: 4, Insightful

      Actually for once I agree with the PHP team here. My biggest complaint with PHP is that many functions give you an arbitrary result when you feed bad data to it rather than return something obvious to show you are trying to do something stupid. In this case the user should be checking to see if the result was NULL and handle the error appropriately rather than happily accepting 0 and not knowing if there was an error or if that was the correct result. Basically he is refusing to validate his input and wanting PHP to do it for him (in a bad way) which is the core of problems like SQL Injection attacks.

      The formatting in DateTime is a perfect example of their absurdity where if you specify 'Y' (4 digit year) in your format but give it a less than 4 digit value (say 12 instead of 2012) it happily makes the assumption that you left out leading zeros (e.g. 12 = 0012). Even better is that if you give a month value greater than 12, it translates that into extra year(s) (int(val/12)) that gets added to the supplied year and then makes the month the remainder (e.g. 19/27/2012 against m/d/Y = 07/27/2013). If I screwed something up, I want to know about it so I can deal with it.

      Then there is the inconsistent error handling functions. Most errors return NULL or false. Of that cross section most don't give you any kind of feedback as to what the error is (though the ones that give you no control and write to STDOUT/ERR really piss me off). The language has Exceptions built in. Use them!!!

      And my personal pet peeve is how it handles the __FILE__ macro if there are symlinks in the path. Contrary to every other language it translates those links so that you can't see the ACTUAL path used to reference the file in question. Even though PHP has functions to translate links in paths the developers continue to claim this is as it should be and refuse to fix it.

    65. Re:Really? by Crudely_Indecent · · Score: 4, Insightful

      Just because someone has been successfully writing bad code for years is not a good reason for the maintaners of the language to enable him to write bad code. The changes were available for testing long before the final version was released. He could have spoken up during the RC phase, but he didn't. He should have tested his code against the RC version and started fixing issues in his code before the final release. Instead, he just installed the new release and started bitching.

      Go ahead and send the link. They'll read that bug report and say to themselves "Why was he sending an empty string to number_format? What did he expect?"

      And they will realize that they've been doing it right all along.

      --


      "Lame" - Galaxar
    66. Re:Really? by 93+Escort+Wagon · · Score: 1

      Indeed. For years now it's been patiently explained over and over and over again what needs to be fixed, and the core team just keeps perpetuating the same crappy nonsense. Since there are other perfectly good languages out there, I see no point in anyone, say, forking PHP.

      Dev 1: Hey, look! Apparently somebody broke crypt! Whoopsie!

      Dev 2: Well, if you decide to fix it - be sure you don't make the code look any less pretty!

      Dev 3: Ah, don't bother. Nobody uses crypt anyway!

      Dev 1: Yeah, I doubt anyone's going to notice... hey look at my shiny new form!

      --
      #DeleteChrome
    67. Re:Really? by Anonymous Coward · · Score: 0

      Submitter could also write:

      function number_format_52( float $number , int $decimals = 0 ) { // replicates old 5.2 code until we can update our code to ensure correctness
          trigger_error("Deprecated function called.", E_USER_NOTICE);
          if (is_null($number) || $number == '') return '0';
          return number_format($number, $decimals);
      }

      then replace all.

    68. Re:Really? by Anonymous Coward · · Score: 0

      You can't make chicken salad out of chicken shit.

    69. Re:Really? by billcopc · · Score: 2

      I knew an admin who'd work on PHP for doing his server maintenance. He hated PHP on web based applications. You kinda remind me of him.

      Yep, I do that too. Most of the time, when I need a small bullshit script for something, it's PHP. The DB integration and no-brainer multi-dimensional arrays make it way too easy to do so many things. I even wrote a bunch of MAME tools with it, because it was the easiest language for quickly parsing ROM parent relationships into a tree and running various operations on the archives with the same fine-grained control as C, but the immediacy and simplicity of shell scripts.

      --
      -Billco, Fnarg.com
    70. Re:Really? by Anonymous Coward · · Score: 1

      That thread alone makes me WANT to use php for everything. Rasmus got it spot on.

    71. Re:Really? by datavirtue · · Score: 0

      Never in the realm of sanity would a number formatter return NULL. Null for numbers is 0. NULL in this case would mean the memory location was.....drum beat.....NULL!

      Wow.

      --
      I object to power without constructive purpose. --Spock
    72. Re:Really? by Crudely_Indecent · · Score: 2

      The PHP manual doesn't say that it will return 0, it says that it will return a formatted version of the $number input. When that input variable isn't a float as the function expects, exactly what is the function supposed to return?

      http://us2.php.net/manual/en/function.number-format.php
      string number_format ( float $number , int $decimals = 0 , string $dec_point = '.' , string $thousands_sep = ',' )

      Maybe it should cause a fatal error because the input did not meet the criteria, would that be better?

      --


      "Lame" - Galaxar
    73. Re:Really? by ArsonSmith · · Score: 0

      exactly:

      NULL is the absence of value
      where
      0 is the absence of value

      Ok, that's a little bit of a smart ass response, really it should be the subtle difference of:

      NULL is the absence of a value
      where
      0 is the absence of value

      --
      Paying taxes to buy civilization is like paying a hooker to buy love.
    74. Re:Really? by shutdown+-p+now · · Score: 1

      More importantly, better alternatives (Python, Ruby) have existed for decades now. What's the point of fixing PHP to be more like Python if there already is Python? It's just a waste of time.

    75. Re:Really? by shutdown+-p+now · · Score: 2

      it lets me code whatever the hell I want without forcing much functional-programming hipster crap down my throat (I'm staring at you: Python/Ruby/Haskell/Scala/Clojure).

      Who's forcing "functional programming hipster crap" down your throat in Python? Have you even tried coding in it?

    76. Re:Really? by NonUniqueNickname · · Score: 2

      Fork?

      Fork You!

    77. Re:Really? by Algae_94 · · Score: 1

      They don't say what it will return if you pass in something other than a number. I just checked the documentation (php.net). This is a function that takes a float value and formats it for display as a string. The documentation clearly states it takes a float, if you pass in a string (empty or not) you are relying on how that string is treated by PHP.

      Should an empty string be formatted as 0? I could imagine a situation where an empty string is returned by some other method because a value was not found in a DB, not because the value was 0. In that case formatting as 0 would be wrong. Lack of knowing a value doesn't make it 0, it makes it an unknown.

    78. Re:Really? by Algae_94 · · Score: 1

      Let's not forget that the bug submitter is complaining that he'll have to change and test for months because of this one change. Was he planning to not test his application at all after upgrading to a new version of PHP?

    79. Re:Really? by TheLink · · Score: 2

      In SQL null for numbers is NULL.

      In other areas, null for numbers might be NaN: http://en.wikipedia.org/wiki/NaN

      --
    80. Re:Really? by Anonymous Coward · · Score: 0

      You think you're a "brilliant coder who worked around PHP's perversions" and like PHP because "it lets me code whatever the hell I want without forcing much functional-programming hipster crap down my throat"?

      I have news for you, you aren't a brilliant coder. You're the typical, in every way, PHP programmer.

      You write shit, are perfectly ok with it, and you do it in PHP, a language that allows you to write the shit you are so proud of.

    81. Re:Really? by Raenex · · Score: 3, Insightful

      Just because someone has been successfully writing bad code for years is not a good reason for the maintaners of the language to enable him to write bad code.

      This is what happens when you start with a sloppy language. People depend on the sloppy behavior, and if you then decide to become more strict, you break people's code. The right way to do this is deprecate the function and introduce a new one.

      Go ahead and send the link. They'll read that bug report and say to themselves "Why was he sending an empty string to number_format? What did he expect?"

      "We are passing a (possibly uninitialized, or null-valued) variable to the function, in hundreds of places and web pages, and we would not expect such a fundamental function to suddenly return a different result."

      So they were depending on existing behavior. Is this shocking? In a language like PHP?

      He could have spoken up during the RC phase, but he didn't.

      "I get it. Yours is bigger, you've worked better, you are at the cutting edge of everything, and you have infinite resources to test every new version of every piece of software in your stack."

      How many people can honestly say they keep up with alpha or beta releases for software they depend on and provide feedback? I've never worked in such an environment.

      There is one very funny bit in that link, where he asks Rasmus to "escalate" the issue.

    82. Re:Really? by Golthur · · Score: 3, Informative

      Maybe it should cause a fatal error because the input did not meet the criteria, would that be better?

      Yes, it would be. Silently failing is one of PHP's most common and egregious sins. I'd rather it fail and fail loudly, so bugs like this can get fixed during development.

      --
      Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
    83. Re:Really? by Grishnakh · · Score: 2

      This is a very important point that all the elitists here keep forgetting about. Want to set up a small, low-volume website on the cheap? There's a ton of less-than $5/month shared hosting providers out there, and all they seem to support are Perl and PHP, so PHP is the choice by default. I keep seeing posts here saying "use Python!", but I don't see much support for Python in the cheap hosting providers, let alone Java.

    84. Re:Really? by myurr · · Score: 3, Insightful

      Yes throwing an error would be better than an inconsistent or, for some developers at least judging by the comments, an illogical result. If the input doesn't make sense then throwing an error is the only sensible way of dealing with it. This will flag the issue to the developer rather than leaving the possibility of an edge case bug sat in the code. But it would appear the PHP devs don't think like that and instead like to preach that their arbitrary way of doing things is better than some other arbitrary way of doing things.

    85. Re:Really? by wkcole · · Score: 1

      Yes, and its universal availability is a result of the low bar it presents to amateurs. Anyone selling very cheap hosting has to sell a lot of it to a lot of people who aren't going to be interested in anything hard.

    86. Re:Really? by myurr · · Score: 1

      So throw an error and highlight the incorrect input rather than choosing between one arbitrary output or another.

    87. Re:Really? by anonymov · · Score: 4, Insightful

      That's not a good example. You want a good example of PHP core team competence, check this saga about fixing an integer overflow bug, for example.

      Or just contemplate about how 20 year old language didn't have the ability to chain method calls and field lookups on objects returned by functions until release 5.4 - it was a _syntax_ error before.

      Or how strings are compared as numbers in unexpected places. I'm not talking about "42" == 42, I'm talking about "42" == "42.0", or "10" == "0xa". Well, using == in PHP is discouraged for reasons like this one anyways (which in itself is quite telling), but check this one out - if we have $x = array('42'), in_array('42.000000000000001', $x) will be true. Can't check this at the moment, but IIRC it's still there in PHP 5.4

      It's bad design through and through. It was OK when it was an hobby project for templating a small homepage, but then it started growing and instead of designing features it got ad-hocs piled on ad-hocs.

    88. Re:Really? by omnichad · · Score: 1

      PHP is a weakly-typed language. The conversion happens automatically. In a lot of cases, this is good. As long as you understand this, it can save time in coding.

    89. Re:Really? by UnknownSoldier · · Score: 1

      Thanks for the interesting link!

      Best comment in the thread...
      "You don't have NULL dollars in your bank account, ... " /facepalm at devs who don't understand exactly why the user is asking why things changed ...

    90. Re:Really? by Anonymous Coward · · Score: 0

      exactly. both php functions are wholly oblivious to html-encoded strings unlike mysql which processes them in the expected manner.

      instead of fucking around with incomplete toy functions like this why not do the encoding/injection checks at the web firewall and use prepared statements at the php-mysql interface point?

      it's truly a joy to remote-audit websites built on php that leverage the community's folklore about coding securely.

    91. Re:Really? by steveb3210 · · Score: 1

      I've spent alot of time writing code in Ruby/Rails... I've now been a PHP dev for 2 years and have used alot of what I learned in rails and applied it to PHP..

      I don't see why you'd prefer php language constructs over Ruby - they are more tedious in every way right down to having to write "array" in front of every array.. (thank heavens they finally changed the latest version)

      @array.map! {|x| x**2 } is much easier to read/understand than using the equivlent array_map function in php.. (Or for that matter using foreach or classic index-based for loop)

      PHP's biggest problem - to me - is the lack of a FastCGI-style environment where code is already running and requests are just fed to the running daemon.. For this reason, its always going to be slower than other languages.... APC is an attempt to do this but its not very mature yet and still requires byte code to be interpreted on each request. Facebook wrote a PHP->C++ translator and that should say alot about the state of the language...

    92. Re:Really? by jbezorg · · Score: 1

      It only silently fails if you tell it to silently fail.

      --
      I've lost all my marbles except one & It's fun to test angular & centripetal acceleration in my skull
    93. Re:Really? by steveb3210 · · Score: 1
      Rails is very easy to deploy..
      1. 1. gem install passenger
      2. 2. Point the apache vhost to the public directory.
      3. 3. Restart apache..

      There ya go, fine tune passenger to your hearts content...

    94. Re:Really? by next_ghost · · Score: 1

      If a number formatter is supposed to default to 0, it's supposed to default to 0.

      The problem is that defaulting to 0 was undocumented behavior. Which makes the bug reporter a moron, his problem a textbook case of PEBKAC and WONTFIX the only appropriate response from PHP developers. Relying on undocumented behavior is equivalent to playing Russian roulette with semi-automatic pistol.

    95. Re:Really? by Anonymous Coward · · Score: 1

      if there already is Python?

      Because the people who write code in PHP don't want to have to implement fastcgi (or even just cgi) by hand in every script, or hope that their hosting company will babysit their django instance and keep it running and configure their webserver to connect to it with mod_wsgi or whatever.

      Make a CGI-enabled version of python that works as well as PHP does for webpages, and you'll have a solid start on making an "alternative".

    96. Re:Really? by Raenex · · Score: 1

      Make it a breaking change, bump the major version up, force people to upgrade through obsolescence and we would be in a much better situation.

      It's actually a pretty shitty idea to force all your users to change all their existing code whenever you want to fix something in an established languge. Deprecate and replace is the better way. If you don't want it hanging around forever, then get rid of the deprecated function in the major release after it was deprecated. The worst thing to do is change the behavior and introduce bugs into an established code base.

    97. Re:Really? by GPLHost-Thomas · · Score: 1

      What you are describing is exactly what's happening in the history of PHP. Things got deprecated in PHP 5.3, and they actually don't work at all in PHP 5.4! The mysql_escape_string isn't one of these IIRC, but that's truth for many other stuff.

    98. Re:Really? by Anonymous Coward · · Score: 0

      PDO has been standard in PHP for ages.

      Did they ever get around to ditching perl's goddamn retarded parameter binding? Because the only reason people write "select $shit from $crap" is because parameter binding makes a one line query take fifty fucking lines of repetitive pointless bullshit code.

      By the time I gave up on PHP, I had written my own class that could do

      $dbh->execute($prepared_query,$_REQUEST);

      with named parameters in the query, using actual database-level prepared queries, and not shit all over itself because the query didn't use every variable in $_REQUEST.

    99. Re:Really? by cowdung · · Score: 1

      I'd like to think I fit in the latter category. I actually really like PHP because it's so dumb and open-ended, it lets me code whatever the hell I want without forcing much functional-programming hipster crap down my throat (I'm staring at you: Python/Ruby/Haskell/Scala/Clojure).

      Exactly my problem with PHP programmers: "lets me code whatever the hell I want"

      and ignore any innovations introduced in programming languages 50 years ago like "functional-programming hipster crap".

      I think it is time to get an education about programming languages and become a professional. You can't continue to use that PHP pacifier forever!

      The world is bigger than PHP and full of scary concepts like:
      - error handling
      - closures
      - multi-threading/parallelism
      - production quality
      - reusable APIs

    100. Re:Really? by Crudely_Indecent · · Score: 1

      There is one very funny bit in that link, where he asks Rasmus to "escalate" the issue.

      Yeah, I chuckled at that part too.

      I liked how the wikipedia link was given instead of an explanation of who Rasmus was. I doubt the person read it though.....then again, maybe that's why he didn't reply further.

      --


      "Lame" - Galaxar
    101. Re:Really? by cowdung · · Score: 1

      Agreed that PHP needs a major cleanup, but the resultant product probably shouldn't be called PHP 6

      I agree entirely.. try some of these forks: http://www.ruby-lang.org/ http://www.python.org/ http://www.java.com/ http://www.microsoft.com/net, http://nodejs.org/

      They are actually good for a change!

    102. Re:Really? by MightyMartian · · Score: 1

      The one thing it underlines is just how poorly thought out PHP's libraries and behavior really was. That we're still dealing with these bizarre issues after all these years shows you the extent of the problem. The other side of the coin is the PHP team always has a pat answer for these issues, and seems profoundly unwilling to do what many library maintainers over the decades have finally decided to do; and that is to clean up the mess. Pick the next major release, create a consistent library that is sane and predictable and doesn't constantly require running to the references because for this weirdo function, a specific argument is first, but another it's the second. Deprecate all existing functions that don't fit with whatever it is you choose, giving developers time to fix their code, and then, on the release after that, dump the deprecated functions entirely.

      Yes I know, we'll have a great hue and cry, but so be it. At some point you want to bring the beast under control, otherwise it just gets worse and worse, and no one can deny that PHP's libraries have been getting more clogged with crap, even as the core language itself becomes at least a tolerable C-like language. If someone two releases down the road still requires PHP 4 support, that's tough. Other library maintainers have drawn lines in the sand. Even Windows x64 doesn't have support for Win16, because there has to be some sane limit to how long you support legacy cruft.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    103. Re:Really? by narcc · · Score: 1

      It sounds like the person filing the bug report would have rather they created a real_number_format function rather than fix a bug in the existing number_format function.

      real_number_format() had a bug. Luckily, we're all rock-star level super-programmers so good that we went right in to the industry from HS (who needs college?) that only work on the biggest and most amazing projects and always produce amazing code.

      So I created real_number_format_new(). Well, the lusers on team didn't get that quite right, but we used it everywhere and some code might have depended on the bug, so I created really_new_number_format()

      After skipping over a work mate's new_real_number_format_final(), I'm currently on really_final_new_real_number_format()

    104. Re:Really? by Jonner · · Score: 1

      What kind of bullshit logic is that? Something is broken, everyone hates it, so let's put all our efforts in making the alternatives better? How about contributing to PHP and fixing what you're bitching about instead of, well, bitching about it? You know, it's open-source and all.

      PHP is a terrible language because of the way it was designed. More accurately, it wasn't designed. Each version improves things here and there, but the basic problem can't be fixed incrementally. There have been far superior languages available, such as Python and Ruby, for many years. AFAICT, the only disadvantage such superior languages have compared with PHP is the lack of a ubiquitous web framework which allows someone to casually start throwing code at a web server and have pages start showing up.

      Better languages have upmteen web frameworks, but none are provided by default, while PHP is both a language and web framework in one. If a single decent framework, such as Django or Rails, were to become ubiquitous the way PHP is, that would solve most of the problem.

    105. Re:Really? by Firehed · · Score: 1

      >If I screwed something up, I want to know about it so I can deal with it.

      I do too, but PHP out-of-the-box isn't designed for that. It's designed to let the lowest common denominator programmer make something that will work, and more sophisticated programmers can set up real error handling (errors/notices to exceptions). After talking about this kind of stuff with Rasmus a couple days ago, I'm going to put together a proposal for a drop-dead-simple way to turn on that behavior with one line of code/config so people that actually know what they're doing can turn on "real programmer mode" in such a way that won't break every crappily-written application on the internet.

      I agree about the __FILE__ thing though. Some project I was playing with that uses that stupid "if (__FILE__ == $_SERVER['REQUEST_FILENAME'])" trick broke in all sorts of interesting ways because my web root is served out of a symlinked directory by nginx. Though symlinks create all sorts of unpredictable behavior everywhere, and get pretty unwieldy to follow. Easy enough to fix with a realpath() call, but still annoying.

      --
      How are sites slashdotted when nobody reads TFAs?
    106. Re:Really? by dhalgren · · Score: 1

      This. PHP was fixed to no longer work the way the bug reported wanted it to work with the reporter's broken code. Why was the reporter allowing uninitialized values in the first place? Was he seriously not planning on testing the codebase after the upgrade?

    107. Re:Really? by Anonymous Coward · · Score: 0

      Looks to me like the programmer who filed the bug was relying on nonstandard behavior to make his code work. Then, he was the first to get upset and pissy.

    108. Re:Really? by asdfghjklqwertyuiop · · Score: 1

      ...has to implement the fastcgi protocol by hand for every single script like python...

      Huh?

      http://trac.saddi.com/flup/wiki/FlupServers

    109. Re:Really? by Firehed · · Score: 1

      Line 3 would work better as:

      if (!$number) $number = 0;

      or

      $number = (float) $number;

      Otherwise you're ignoring your decimals parameter in the null case, and creating a new bug ;) You should also maintain the original function's signature, with $dec_point = '.' and $thousands_sep = ','

      --
      How are sites slashdotted when nobody reads TFAs?
    110. Re:Really? by Eponymous+Hero · · Score: 1

      0 is a number and a boolean state. null is appropriate for non numerical arguments and prevents variables from being set with boolean/integer values.

      --
      insensitive clod overlords obligatory xkcd car analogy russian reversals whoosh pedant fanbois ftfy in 3...2...1..PROFIT
    111. Re:Really? by Firehed · · Score: 1

      What? Just fix the bugs. Then you can upgrade whenever you please.

      The code in question was reliant on the "garbage in, garbage out" idea. When the function changes to "garbage in, error out", that means you need to stop feeding it garbage, which you can do whenever you get off your ass.

      --
      How are sites slashdotted when nobody reads TFAs?
    112. Re:Really? by Firehed · · Score: 1

      And you want to have to wait for a major release (plus probably two minors, to be safe) to fix your database input sanitizer? I think not.

      Granted, it would have been better to make mysql_real_escape_string (per the example) a temporary function for the next minor version of the current major release, and immediately deprecate it when the behavior of the original is fixed in the next major version, but oh well. You should be using prepared statements anyway :p

      --
      How are sites slashdotted when nobody reads TFAs?
    113. Re:Really? by Anonymous Coward · · Score: 0

      Err, meant to say s/returned by functions/returned by constructor/, that is, until this year you couldn't say something like new URL("http://example.org")->openStream(). Function calls had their own quirk (fixed in 5.4 as well) - givemeanarray()[0] was "'[' unexpected"

      And if you're wondering, method call chaining in general, a basic property of any OOP language, was added to PHP when it was ten years old, in PHP5.

    114. Re:Really? by Anonymous Coward · · Score: 0

      And now, it is! It notices the error, and returns NULL instead of pretending that a string is a number. Great!

      I agree that it shouldn't just work. But returning NULL? Seriously? If it is an error, you throw an exception. That'd also have made the whole bugreport unecessary as the answer to his question would have been right there in the exception message: Invalid input.

    115. Re:Really? by hobarrera · · Score: 1

      Because the devs have a strong stance on most of the things complain about, so you can't contribute back - like the lack of finally , for example.

    116. Re:Really? by neonKow · · Score: 1

      Probably write good code in the first place.

    117. Re:Really? by hobarrera · · Score: 1

      I think most people capable of contributing to PHP, would prefer to contribute to Python/Ruby/Perl/insert-another-language here, rather than fork a really broken language.

    118. Re:Really? by Anonymous Coward · · Score: 0

      start_response('200 OK', [('Content-Type', 'text/plain')])

      You've already lost.

    119. Re:Really? by thetoadwarrior · · Score: 1

      Honestly, what's the point? Everyone will bitch when compatibility is broken or if they do something like Perl and do a "PHP6" then people will bitch. Unfortuantely for PHP is appeals to newbs, casuals and tightwads. In other words the sort of people that hate having to fix their code because they most likely can't.

      In fact there was just a reddit submission the other day about some company crying about a bug fix breaking their code and the comments on the ticket just turned into a pile of retardation. The core developers don't seem to care much about the language either and that's probably because of their typical userbase. PHP is dying and tbh it's for the best.

    120. Re:Really? by asdfghjklqwertyuiop · · Score: 1

      That has nothing to do with fastcgi

    121. Re:Really? by thetoadwarrior · · Score: 1

      You should be able to break things when it makes sense. The fact they feel they can't just shows the average PHP coder is an idiot and because of that it's holding the language back.

    122. Re:Really? by Anonymous Coward · · Score: 0

      You can't just fix PHP. There's no one place to fix it, it's built out of design errors on top of poorly thought out implementations and emulation of previous mistakes. We're talking about a language created by a man that argued against type-observing equality operators. PHP is just bad and brain damaged - it probably would have died out by now were it not for those cocksuckers at Zend that went out and created a rock-solid, easy to deploy, fast implementation of this steaming shitpile of a language.

    123. Re:Really? by allo · · Score: 2

      but it should only happen automatic, when the input is sane.

    124. Re:Really? by allo · · Score: 1

      and WTF are the old functions still there and not just replaced with the new ones?

    125. Re:Really? by eddy+the+lip · · Score: 2

      When you admin the server, this is great. I usually do these days, but do still occasionally deploy on shared servers, or servers that are severely locked down. Sure, it's kind of a bullshit restriction, but it's one of the reasons a poor, but ubiquitous, technology sometimes wins out.

      As an aside, we were recently approached by a large organization to redevelop their website. One of the things they want is to move away from Ruby on Rails because they were having too hard a time finding qualified developers. I know - you can find them - but when you are a non-tech company making these kinds of decisions, you do want to make sure you can find qualified devs without *too* much fuss.

      I guess just a point in the "not about the technology" department :/

      --

      This is the voice of World Control. I bring you Peace.

    126. Re:Really? by Anonymous Coward · · Score: 0

      Like this one?

      number_format("",0);

      Warning: number_format() expects parameter 1 to be double, string given in ...

    127. Re:Really? by Anonymous Coward · · Score: 0

      It was less of "garbage in, error out" change, and more "garbage in, arbitrary default out" to "garbage in, arbitrary and arguably less relevant default out"

      This change just breaks improperly written code without making the error clear. NULL is still == (though not ===) 0, and NULL + $number === 0 + $number, but, for example, it subtly breaks on NULL . 'string' == 0 . 'string' - one gives 'string', and another '0string'. $array[NULL] is equivalent to $array[''], not $array[0], which leads to helpful error "Undefined index: in somefile.php" on read, or might lead to $array suddenly having both [0] and [''] elements on write.

      IOW, submitter is incompetent, and developer is incompetent, which still agrees with GGP's "The problem lies at its core. You can't fix people."

    128. Re:Really? by Anonymous Coward · · Score: 0

      He could just write a new function that calls the changed function that checks if a NULL value is being returned and replaces it with 0...

      What a More-Ooon

    129. Re:Really? by Anonymous Coward · · Score: 0

      I'd like to think I fit in the latter category.

      Python and Ruby are both highly imperative and object oriented. Hardly "functional-programming hipster crap" by any stretch of the imagination. You're pretty much the stereotypical imbecile PHP coder...

    130. Re:Really? by fbartho · · Score: 2

      Got any links? I thought that Facebook's PHP was just a different compiler with the same, but faster, library stack?

      --
      Gravity Sucks
    131. Re:Really? by zedeler · · Score: 1

      Digging around in PHPs github repository reveals that yes - they did commit the buggy code mentioned, but it was never part of any official release. The following release - 5.2.4 - had already been fixed. (To the best of my knowledge.) This is not a general defense of PHP. I have my own reason to dislike the language as well as the community.

    132. Re:Really? by Anonymous Coward · · Score: 0

      Also, it's hipster the same way the love & peace movement of 1970 is hipster, that is: not at all.
      It's standard for several decades now and required to do in university.

      Doing it any other way is weird, although endearing like an eccentric grandpa.

      Those languages billcopc listed are pretty much the best of the best languages. They are the reason I still program. I originally thought it's ALL caveman with chisels (C, BASIC, Assembly, looking at you) and wanted to get out. Turns out there are sane people.

    133. Re:Really? by Alioth · · Score: 1

      That the mysql_ functions exist is bad enough - even Perl had that right with DBI and just one API for all databases.

    134. Re:Really? by Garble+Snarky · · Score: 1

      It returns a string. What is null for strings?

    135. Re:Really? by multicoregeneral · · Score: 1

      Right. But that's not the fault of the language. Just because it can be parsed, doesn't mean it's good code. I can write atrocities in twelve programming languages. That fact doesn't make me a master programmer. If that were all I had, it would make me a hack. The same applies here.

      --
      This signature intentionally left blank.
    136. Re:Really? by Anonymous Coward · · Score: 0

      PHP's default header is 200 OK. You might be forgiven for setting the content type to text/plain since it didn't emit html, but I suspect that you have to explicitly set html as the content type for your script. mod_python would have been a better "this is how it should be done", even if it hasn't been developed on since 2007. The example there shows how all you have to do is return your HTML as a string. I'd almost bet you could even edit that in dreamweaver and get something halfway usable!

    137. Re:Really? by mwvdlee · · Score: 1

      Backwards compatibility.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    138. Re:Really? by Anonymous Coward · · Score: 0

      Their arguments are backwards. They have passed a blank string as the number, and 0 as the format.

    139. Re:Really? by Mathieu+Lu · · Score: 1

      That doesn't seem to me like a particularly good example. The reporter is being a dick and in most other languages this sort of behavior would have been classified as "undefined".

    140. Re:Really? by Crudely_Indecent · · Score: 1

      Garbage in - Garbage out

      If you provide a string or null to a function that expects a float - what do you expect it to return - a unicorn barfing a rainbow?

      If you don't want to initialize the input - fine! It's easy enough to do it with a conditional within the function itself!

      $input=null;
      $output = number_format((is_numeric($input)?$input:0),0); // $output = "0";

      --


      "Lame" - Galaxar
    141. Re:Really? by grcumb · · Score: 1

      Yes I know, we'll have a great hue and cry, but so be it.

      You're not worried about someone seeing red? (hint: it's 'hew')

      --
      Crumb's Corollary: Never bring a knife to a bun fight.
    142. Re:Really? by Anonymous Coward · · Score: 0

      I honestly don't see how this demonstrates any problem with PHP people.

      The guy was using some function in what appears to me as the wrong way (failed to validate inputs) and was relying on some edge-case behaviour. Now this edge-case behaviour has changed and made the mistake in his code more apparent.

      I hate PHP and try to avoid it like plague, but this guy got what he was asking for.

      By using PHP in the first place?

    143. Re:Really? by Terrasque · · Score: 1

      In PHP, ALL of these statements are evaluated as true (fetched from one of the articles):

      NULL < -1
      NULL == 0

      "foo" == TRUE
      "foo" == 0
      TRUE != 0

      123 == "123foo"
      "123" != "123foo"

      Scared yet? You can use === for comparison to fix some of those, except... < > does not have such an alternative. And for objects:

      === compares values and type... except with objects, where === is only true if both operands are actually the same object!
      For objects, == compares both value (of every attribute) and type, which is what === does for every other type.

      Writing code in PHP is sometimes akin to using an unicycle to traverse a minefield.. And if you're not damn paranoid about reading docs and testing things in real life, or have years and years of experience with that crap.. You're doing it blindfolded.

      --
      It's The Golden Rule: "He who has the gold makes the rules."
    144. Re:Really? by asdfghjklqwertyuiop · · Score: 1

      I still don't know what you're talking about. It still doesn't have anything to do with implementing the FastCGI. protocol in every script that you write. start_response() is WSGI which can be run completely without FastCGI. If you don't want to say "start_response('200 OK', [('Content-Type', 'text/plain')])" all the time then don't write your web app in WSGI. Use some higher level frame work like django or something.

    145. Re:Really? by julesh · · Score: 1

      How about contributing to PHP and fixing what you're bitching about instead of, well, bitching about it? You know, it's open-source and all.

      Because the problem is fundamental. It's the core language design, the way the standard libraries work, the way the core development team think. You can't fix it without turning it into an entirely different language developed by an entirely different team. You might as well start from scratch.

    146. Re:Really? by Terrasque · · Score: 1

      That's brilliant! Thank you!

      Perfect explanation. PHP is the Excel of the web programming world. Explains everything.

      --
      It's The Golden Rule: "He who has the gold makes the rules."
    147. Re:Really? by Anonymous Coward · · Score: 0

      > Wow. Every time someone says PHP isn't that bad, I am going to send them that link.

      Don't bother; just smack them upside the head.

      It's quicker and the result will be the same.

    148. Re:Really? by narcc · · Score: 1

      How this got modded interesting, I'll never know. You didn't actually say anything!

      PHP has some fundamentally wrong assumptions in its design,

      Okay, now you're going to tell us about them, right? See, that would actually be interesting.

      you can't fix it without just making it something that isn't PHP.

      Oh, I guess not...

      PHP has some warts, sure, but the most common criticism has been just inconsistent naming. There used to be some moaning that it was "object oriented", which I and many others considered a plus, but that's hardly "fundamentally wrong". I guess I'm missing something here?

      Please, enlighten us lusers. How did you come to your your undoubtedly well-reasoned conclusion?

    149. Re:Really? by Anonymous Coward · · Score: 0

      PHP has some warts, sure, but the most common criticism has been just inconsistent naming. There used to be some moaning that it was "object oriented", which I and many others considered a plus, but that's hardly "fundamentally wrong". I guess I'm missing something here?

      This critique was going around recently detailing the problems with PHP. I'm not partisan, but it's clearly more than just a case of messy evolution:

      http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/

    150. Re:Really? by Phroggy · · Score: 1

      No, 0 is not NULL. But "" cast as an INT could be considered NULL.

      NULL is not an INT!

      "" cast as an INT should be treated as 0, that's the behavior I would expect from every other language I've ever worked with. If you have a string (empty or not) that does not look like a valid number, and you turn it into a number anyway, you get 0.

      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    151. Re:Really? by Phroggy · · Score: 1

      Go ahead and send the link. They'll read that bug report and say to themselves "Why was he sending an empty string to number_format? What did he expect?"

      Considering the lack of any documentation to the contrary, what he expected was the same behavior he'd been getting with previous versions of PHP.

      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    152. Re:Really? by Phroggy · · Score: 1

      This is what happens when you start with a sloppy language. People depend on the sloppy behavior, and if you then decide to become more strict, you break people's code.

      Precisely.

      It's OK to take some shortcuts in your implementation and reserve the right to change the behavior later. Other languages do this all the time. The documentation will explicitly say something like "number_format expects to be passed a numeric value; if you pass it something that is not a number, the results are undefined." This is a clear signal that, even though the behavior may be consistent and predictable today, the behavior could change in a different implementation tomorrow and the onus is on you to make sure you're not doing whatever stupid thing they said you shouldn't do. PHP didn't do that.

      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    153. Re:Really? by Anonymous Coward · · Score: 0

      Looks like "endosquid" took a stupid shortcut that bit him in the ass.

    154. Re:Really? by Johann+Lau · · Score: 1

      If by "result" you mean "makes you seem bitter and helpless", yeah ^^

    155. Re:Really? by Anonymous Coward · · Score: 0

      "" cast as an INT is an error in the program code. This should generate an error, not return a value.

    156. Re:Really? by tibit · · Score: 1

      It's designed to let the lowest common denominator programmer make something that will work

      Nope. It's not designed for that. There's an utter lack of coherent design. The lower common denominator programmer must not be given all sorts of ways of safely shoot him/herself in the foot. In C/C++ when you shoot yourself in the foot, there's blood and it's usually obvious sooner rather than later (yeah I know not all security holes are that trivial, but a zero dereference usually is quite obvious). In PHP, the bullets are made of a potent anesthetic. By the time you realize you're full of holes, your neighbor has used one to fuck your wife without you noticing.

      PHP lets the lowest common denominator programmer make something that is always full of security holes, silent data corruption and is usually no more than a proof of concept that should be treated no better than that. It lets the programmer fool him/herself and the client, too.

      --
      A successful API design takes a mixture of software design and pedagogy.
    157. Re:Really? by Anonymous Coward · · Score: 0

      Oh yes, I'm sure they wouldn't stick with your broken browser... I mean broken language interpreter for decades after you drop support. That sure has never happened before!

    158. Re:Really? by Crudely_Indecent · · Score: 2

      PHP is well documented. in another reply, I provided a link to the number_format function.

      it expects a float, not a null or a string. the documentation is very clear.

      --


      "Lame" - Galaxar
    159. Re:Really? by Johann+Lau · · Score: 1

      Because that what they say they will return. Regardless if you pass in unchecked arguments.

        How can you properly debug code if documented fuctions dont behave in the way documented and acts inconsistantly??

      If you're too lazy to wrap intval around, or put (int) in front of, a string which is NEEDED to be a number -- what other horrible abominations might your code contain? In accounting software, no less? *shudders*

      Also, you're flat out wrong.

      http://php.net/manual/en/migration53.incompatible.php

      The newer internal parameter parsing API has been applied across all the extensions bundled with PHP 5.3.x. This parameter parsing API causes functions to return NULL when passed incompatible parameters. There are some exceptions to this rule, such as the get_class() function, which will continue to return FALSE on error.

      So yeah, that link. It's some kind of Barbara Streisand thing, people just don't get how hard it backfires :P Not saying PHP isn't kind of a minefield; but if you don't code accordingly, I'm just gonna point and laugh when you blow up, sorry. And hey, nobody uses PHP because it's so great, but because it runs on just about any webhost, period. See how that works? You're comparing apples with oranges when you bring up any alternative which, well, isn't really one. That's saying "use this car instead, it has much better controls for people who can't drive, and nicer seats for people who are lazy; that it only runs on main roads is surely a minor concern". Which again makes me question the whole logic/brain thing, just like posts getting modded as they are in some kind Pavlovian ballet haha.

    160. Re:Really? by Anonymous Coward · · Score: 0

      > I don't see much support for Python in the cheap hosting providers, let alone Java.

      There's a little company that supports both Python and Java for free or cheap: https://developers.google.com/appengine

    161. Re:Really? by Compaqt · · Score: 1

      And Perl didn't have DBI right when Perl emerged from Larry Wall's head.

      Don't use mysql_*.

      Use the PDO library for database-independent access.

      --
      I'm not a lawyer, but I play one on the Internet. Blog
    162. Re:Really? by Anonymous Coward · · Score: 0

      I also like how Rasmus solved months of work with a single bash line :P

    163. Re:Really? by Anonymous Coward · · Score: 0

      And my personal pet peeve is how it handles the __FILE__ macro if there are symlinks in the path. Contrary to every other language it translates those links so that you can't see the ACTUAL path used to reference the file in question. Even though PHP has functions to translate links in paths the developers continue to claim this is as it should be and refuse to fix it.

      I agree with your sentiments about datetime, but __FILE__ functionality should not expose anything about the host system it should not need to. If someone injects scripts into your site, why would you want them to have even more permissions than the already badly lax by default PHP config allows?

    164. Re:Really? by Anonymous Coward · · Score: 0

      And they are doing that, slowly. Which is another reason PHP is successful. You know how IE6 stays around because large organizations still use it to keep things running. Well, PHP keeps compatibility rather high for similar reasons. Typically they will deprecate a function for a long time before they remove it, and in the meantime will introduce fixed functions. Though they aren't perfectly consistent in this.

      Still, most code written tends to keep running just fine...

    165. Re:Really? by soundguy · · Score: 1

      You can't make chicken salad out of chicken shit.

      You clearly don't work in marketing. Anything is possible with the right ad agency.

      --
      Nothing worthwhile ever happens before noon
    166. Re:Really? by Anonymous Coward · · Score: 0

      You can't make chicken salad out of chicken shit.

      You clearly don't work in marketing. Anything is possible with the right ad agency.

      Just because you can label and sell chicken shit as chicken salad doesn't actually make it chicken salad. :)

    167. Re:Really? by Anonymous Coward · · Score: 0

      Yep, I do that too. Most of the time, when I need a small bullshit script for something, it's PHP. The DB integration and no-brainer multi-dimensional arrays make it way too easy to do so many things. I even wrote a bunch of MAME tools with it, because it was the easiest language for quickly parsing ROM parent relationships into a tree and running various operations on the archives with the same fine-grained control as C, but the immediacy and simplicity of shell scripts.

      When I make a small bullshit script for something, I use BASH. I develop in PHP every day, because it has it's strong points (primarily the ease in learning, which can often spark further endeavors as it did me), it's easy to point out to someone with a pure CS degree and no actual coding knowledge why a simple logic check works or doesn't, and it is very easy to read and NOT whitespace sensitive. Thus my gg=G will flawlessly indent to my standards, which Python fails on.. And I love Python..

      I shit you not though, I currently work with someone with 25 years in C++ application development that couldn't figure out a switch statement in PHP. That kind of incompetence amazes me.

    168. Re:Really? by myurr · · Score: 1

      But here you have garbage in = non-numerical return value from a function that is supposed to return a number albeit in string form. If this function is just being used to display a number to the end user, which is pretty typical use, then the result is going to be garbage in = a number somewhere isn't displayed properly to the user so they need to notice this and report the bug.

      If garbage in = throw an error then whilst the user would see an error this is much more easily detected by the code itself and gracefully handled whilst notifying the developer of the problem. The developer will also be able to see where the problem is and be able to trace it back through the code from the input to the number_format call backwards, rather than having to worry about any code after that function call and trying to work out exactly what the user did in order to trigger this weird result in the first place. By having an error with a good error message they get an exact starting point for their investigation.

      PHP is riddled with functions that instead of doing the right thing try to guess at what they should be outputting, leading to a huge number of hard to detect bugs, erroneous behaviour, and ultimately fragile programs. This particular call merely highlights one such function, and it looks like the core devs simply do not understand the innate issues with their chosen approach.

      To bring this back to the topic of the article itself - a huge amount could be done to improve PHP by forking the project and redesigning the core library to be safe and consistent, removing all the broken functions that have been retained for backwards compatibility, and simplifying the library as a whole.

    169. Re:Really? by radio4fan · · Score: 2

      Silently failing is one of PHP's most common and egregious sins.

      It doesn't silently fail. It generates a warning:

      Warning: number_format() expects parameter 1 to be double, string given in /foo/bar/baz.php on line X

      I'd rather it fail and fail loudly, so bugs like this can get fixed during development.

      Which is why you don't disable warnings.

      Maybe you want php to treat warnings as errors? No problem:

      set_error_handler().

    170. Re:Really? by julesh · · Score: 1

      The documentation clearly states it takes a float, if you pass in a string (empty or not) you are relying on how that string is treated by PHP.

      Yes, but the way it is treated seems to violate the way the documentation says it will be treated. This section of the manual states that strings will automatically convert to floats where the conversion is required by context. This section states that when a string that does not begin with a digit is converted to a numeric type, the result is 0.

      Should an empty string be formatted as 0? I could imagine a situation where an empty string is returned by some other method because a value was not found in a DB, not because the value was 0. In that case formatting as 0 would be wrong. Lack of knowing a value doesn't make it 0, it makes it an unknown.

      I completely agree, yet this is not how PHP is documented to work. Now, I consider the specified automatic conversion between strings and numbers to be a design flaw of the language, but as long as it is documented that empty strings are autoconverted to zero when context requires it, this should be what actually happens.

    171. Re:Really? by julesh · · Score: 1

      The PHP manual doesn't say that it will return 0, it says that it will return a formatted version of the $number input. When that input variable isn't a float as the function expects, exactly what is the function supposed to return?

      The PHP manual says that strings are automatically converted to numbers when required by context. It further states that strings that do not begin with a digit are converted to 0. I'd say it's supposed to return "0", given these specifications in the manual.

    172. Re:Really? by radio4fan · · Score: 1

      Yes throwing an error would be better than an inconsistent or, for some developers at least judging by the comments, an illogical result.

      If you pass a string to number_format(), php generates a warning.

      People whine about php being inconsistent, then when they make changes to make it more consistent, people whine.

      They're damned if they do, and damned if they don't.

      The fine individual who reported the 'bug':

      • Has warnings turned off in his php config (OK for production, but stupid for development)
      • Jumps two major versions of php without reading the documentation (this change is the first item on the upgrade notes for php 5.3)
      • Is passing around strings and expecting them to behave like numbers in an application for tax and retirement planning.
      • And surely the biggest WTF of the lot: He thinks that redirecting calls to number_format to a wrapper function will be hard to get through his 'change-request-release environment', but running and maintaining a private fork of php will be no problem

      But it would appear the PHP devs don't think like that and instead like to preach that their arbitrary way of doing things is better than some other arbitrary way of doing things.

      There's enough to criticise about php without attacking a straw man.

    173. Re:Really? by radio4fan · · Score: 1

      Make it a breaking change, bump the major version up, force people to upgrade through obsolescence and we would be in a much better situation.

      I completely agree. But look at the butt hurt over the fix to number_format() et al.

      They really are damned if they do, and damned if they don't.

    174. Re:Really? by julesh · · Score: 1

      It logs a warning and continues executing. This is not the same thing as failing loudly, for which purpose I would suggest throwing an exception (which PHP has supported for many years now).

    175. Re:Really? by beelsebob · · Score: 1

      Okay, now you're going to tell us about them, right? See, that would actually be interesting.

      Okay, lets start with the type system. The type system allows you to treat everything the same, and ends up with all kinds of crazy inconsistencies, like the fact that == is not transitive...
      "abc" == true is true; "abc" == 0 is true; true != 0.
      That's just fundamentally wrong, and it's not something you can fix without just going "you know what, this type system is retarded, lets have a real type system".

      What do you think NULL++ is in PHP? What about NULL--? What about "null"++ or "null"--?

      There's also a high number of special cases in the language, e.g. "array" and "=>", which are not a function and operator respectively; while [] somehow can be overwritten as a bog standard variable. Neither can be fixed, as changing the assumption will break existing code.

      Want to try and fix the above problems with "==" by using "==="? Well, that has its own problems – suddenly "==" compares the types of objects, while "===" doesn't... But "===" compares the types of primatives, but "==" doesn't. Want to change it? Well, you can't really – that would change pretty much everything about the language.

    176. Re:Really? by micheas · · Score: 1

      I agree that php without a framework is completely impossible.

      Unfortunately all the frameworks are their own languages so to speak so php is sort of a thousand different dialects that don't really translate that well from one to another.

      Also, the bugs and gotcha's tend to bubble up through the frameworks.

    177. Re:Really? by Anonymous Coward · · Score: 0

      What I personally hate most is how the interpreter just dies quietly on syntax errors and there seems to be no way to make it give you any indication of what's wrong.

    178. Re:Really? by Anonymous Coward · · Score: 0

      WAIT! WAIT! IMMA GONNA START MY POST! ... wouldn't it be stupid if I started every post like that, and yet I have to start every script like that?

      You seem to have misunderstood somewhere along the line. This is about making something as easy as PHP. If I have to call more than one function just to write hello world, you're harder than <? echo "Hello World"; ?>, or in the case of mod_python, return "Hello World";. If you throw Django at the problem, well... as they say, now you have two problems.

    179. Re:Really? by narcc · · Score: 1

      The type system allows you to treat everything the same,

      "I don't understand the type system and I don't like it" is not a fundamental problem of the language. If you want static typing, use C.

      Heh, if you want to see what a totally screwed up type system actually looks like, take a look at Java.

      and ends up with all kinds of crazy inconsistencies, like the fact that == is not transitive...
      "abc" == true is true; "abc" == 0 is true; true != 0.

      Wow, total fail! First, go read about how the == operator works and how types are converted between one another. Now, make a table and see what is actually being tested for equality. Oh, the magic bullshit vanishes and it turns out the transitive relation really does hold? Too funny! Heh, you can actually make a bullshit example like yours in many modern languages. Of course, it's still total nonsense -- but I'll bet it'll still convince morons that you're brilliant and the the language is "fundamentally flawed".

      Want to try and fix the above problems with "==" by using "==="?

      Ummm... No. You use == and === where appropriate. Read the fucking documentation. This isn't complicated. Any idiot can figure this out. (Wait, that's wrong. judging from this thread, not every idiot can handle something this simple.)

      Well, that has its own problems – suddenly "==" compares the types of objects, while "===" doesn't...

      Gee, I wonder why that is. If only I wasn't a total moron and could puzzle out why that's perfectly sensible... (Seriously, if you can't see what this makes perfect sense, I can't help you. It only looks inconsistent if you don't know anything about programming languages.)

      What do you think NULL++ is in PHP? What about NULL--? What about "null"++ or "null"--?

      Who cares? If you find yourself in any of those situations, you very obviously have bigger problems. I recommend switching professions to something more your speed, like "highway construction flag holder".

      To directly answer your question, null++ behaves exactly the same way it does in other dynamically typed languages. So $a=null; $a++; $a will have a value of 1 It's the same, for example, in javascript. The string case "null"++ (well, $a=null; $a++; so that you can actually try it out.) is different between them because strings aren't the same kind of thing in js and php. PHP behaves like perl and returns "nulm" javascript will return NaN. Again, if you find yourself in a situation where this is relevant, you've probably made more than one horrible mistake.

      Want to change it? Well, you can't really – that would change pretty much everything about the language.

      Why would you want to change it? It's not broken! That you can't handle dynamic typing is not a fault of the language -- why it baffles you so, I'll never know.

      There are plenty of legitimate gripes about PHP. This is not one of them. Go, and find an actual reason.

    180. Re:Really? by The-Dark-Star · · Score: 1

      Good points here, but I really have to disagree on the Python piece. Python does not force anything down your throat, it is about as close to a blank slate as you can get. It has a great OO model, it does multiple inheritance in the simplest manner I have seen (I do miss interfaces though). OR, you can do functional programming. Or you can do procedural. It really is up to you. As far a PHP is concerned, I would agree that the only way for the language to survive long-term is to deploy a break release, and be adamant about fixing core issues. I think a fork is not likely to happen, nor do I think it would be a big help. As much as I respect Rasmus, I wish someone else would take the reigns and steer it into a more respectable direction.

    181. Re:Really? by Crudely_Indecent · · Score: 1

      maybe you should read it again

      http://php.net/manual/en/function.number-format.php

      it says
      Return Values

      A formatted version of number.

      --


      "Lame" - Galaxar
    182. Re:Really? by beelsebob · · Score: 1

      "I don't understand the type system and I don't like it" is not a fundamental problem of the language. If you want static typing, use C.

      Heh, if you want to see what a totally screwed up type system actually looks like, take a look at Java.

      Remember – the argument you're meant to be making here is that PHP is not so broken that we should go and use another language. If your response is "if you think that's broken, go and use another language", then you're not being very convincing are you ;)

      Wow, total fail! First, go read about how the == operator works and how types are converted between one another. Now, make a table and see what is actually being tested for equality. Oh, the magic bullshit vanishes and it turns out the transitive relation really does hold?

      Clearly you don't actually understand what transitivity means. Finding an example a == b && b == c but not(a == c) is a proof of == not being transitive.

      Ummm... No. You use == and === where appropriate. Read the fucking documentation. This isn't complicated.

      It being documented is not the same thing as it being sane, or well designed, or sensible in a programming language ;)

      Who cares? If you find yourself in any of those situations, you very obviously have bigger problems.

      I'd tend to agree –which only goes to back up the argument that a type system that allows this kind of stupidity is retarded ;)

      I notice you carefully skirted around the issue of null--, when you asserted that these example behave the same as in other dynamic languages.

      Why would you want to change it? It's not broken!

      Wow, if you don't think these things are fundamentally broken, the programming community is more fundamentally broken than I realised. Really? People don't realise that mathematicians have worked out sets of consistent rules that give nice properties? People *really* don't realise that languages that don't conform to those sets of axioms end up being cluster fucks of corner cases, just like php?

    183. Re:Really? by asdfghjklqwertyuiop · · Score: 1

      Yeah... I used to write PHP more often ~5+ years ago. The only time I miss the easiness of is in when doing the simplest things. I still use PHP for such things once in a while. But In every other way I find Python to be better and that verbosity you're talking about winds up insignificant.

    184. Re:Really? by Anonymous Coward · · Score: 0

      Bill reminds me of me. I've programmed a lot over the years.

      When I go into a place and look at their code, my first question isn't what language it's written in. Sheesh, there is a lot of excellent COBOL and Basic code out there still running fine.

      My question is how well the programs are written. People can write crap in any language. But I tend not to use super-arcane features of languages myself, preferring to stick with what most people would regard as decently commented, universally readable code. It may not be 99.9% efficient, but 80% of the cost of a program is in maintaining it anyway. I dare say that my simplistic looking programs are easier to prove the correctness of and easier to maintain because of this.

      So PHP isn't perfect, but it's fairly generic, and I think I do a pretty good job in it. If you are one of those language snobs, then you may want to reconsider your position. Programming isn't about blaming bad code on the language, but rather what you can do with it. There is no perfect language -- although others are less perfect than others. Perl... sheesh.

    185. Re:Really? by Anonymous Coward · · Score: 0

      right, because completely removing and changing stuff inbetween versions worked so well for python 2.x and 3.x. It's not like there's a thriving community of 2.x users out there at all.

    186. Re:Really? by jeffb+(2.718) · · Score: 0

      Nothing really to add to this, except how pissed off I am that I have to make a content-free post and undo ALL my mods in this thread because my finger slipped and I modded this "Troll" instead of "Insightful". Really, Slashdot, how many years is it going to take to get that idiotic misfeature fixed?

    187. Re:Really? by gmyuriy · · Score: 1

      I think you are missing the poster's point - that was not about the issue but the attitude

    188. Re:Really? by Anonymous Coward · · Score: 0

      Yes, and according to the conversion rules given in the manual, an empty string as the $number argument should be treated as 0, so the "formatted version" would be the string "0".

    189. Re:Really? by narcc · · Score: 1

      If your response is "if you think that's broken, go and use another language", then you're not being very convincing are you ;)

      Considering that wasn't my response, I think I'm okay.

      Clearly you don't actually understand what transitivity means.

      I know exactly what it means. I also explained why your claim that that property didn't hold was total bullshit.

      It being documented is not the same thing as it being sane, or well designed, or sensible in a programming language ;)

      Fine, but you haven't given any actually reason why it's "insane" or "poorly designed". As I've already pointed out, it works exactly like other dynamically typed languages! Christ, what the fuck is so hard about this? Just because you don't like dynamic typing does not mean that all dynamically typed languages are "fundamentally broken".

      Wow, if you don't think these things are fundamentally broken, the programming community is more fundamentally broken than I realised. Really? People don't realise that mathematicians have worked out sets of consistent rules that give nice properties?

      You're a moron. First Your == isn't transitive claim is false, as I've explained. It's not my fault you didn't understand it. Second, you clearly don't understand programming languages! For example: any OOP language that includes both incapsulation and inheritance (what *actually* are fundamentally opposed) is demonstrably incoherent. A bit worse than a bullshit claim about an operator, that like in may languages, does some type conversion before testing. (Again if you compare what is actually tested for equality, you'll see why your example is bullshit. I'll be that you can come up with a similar bullshit example in your prefered language!)

    190. Re:Really? by beelsebob · · Score: 1

      I know exactly what it means. I also explained why your claim that that property didn't hold was total bullshit.

      There is a (admittedly outlined) mathematical proof that transitivity does not hold in my replies to you. Feel free to tell me why that's bullshit.

      Fine, but you haven't given any actually reason why it's "insane" or "poorly designed". As I've already pointed out, it works exactly like other dynamically typed languages! Christ, what the fuck is so hard about this? Just because you don't like dynamic typing does not mean that all dynamically typed languages are "fundamentally broken".

      Except, as we covered, there are important ways in which php differs here, which are inconsistent. Those inconsistencies introduce corner cases in the semantics of the language. Those corner cases make the language fundamentally broken.

      You're a moron. First Your == isn't transitive claim is false, as I've explained.

      You mean, as I've proved it to be true ;)

      Second, you clearly don't understand programming languages! For example: any OOP language that includes both incapsulation and inheritance (what *actually* are fundamentally opposed) is demonstrably incoherent.

      Did I mention anything about OOP being a magical cure to everything? Or in fact OOP at all? Personally I regard OOP as fairly broken too, just not as broken as php is. As an aside – does OOP being broken mean php is not broken? No it doesn't – saying that it does is simply presenting a straw man.

      For now though, I'm not really willing to argue with someone who does not take a mathematical proof as valid argument. I'm quite happy to accept that you enjoy php, and you're free to use it... I will however continue to claim, with proof, that your preferred language is fundamentally flawed.

    191. Re:Really? by Anonymous Coward · · Score: 0

      "abc" == true is true; "abc" == 0 is true; true != 0. That's just fundamentally wrong, and it's not something you can fix without just going "you know what, this type system is retarded, lets have a real type system".

      I'm no expert in dynamic typing, so help me out here... is the conversion of "abc" (string type) to "true" (boolean type) wrong, or is conversion of "abc" to 0 (integer type) wrong?

    192. Re:Really? by narcc · · Score: 1

      There is a (admittedly outlined) mathematical proof that transitivity does not hold in my replies to you. Feel free to tell me why that's bullshit.

      Damn, you're thick! It's like talking to a pile of rocks!

      Your example is bullshit. It's just like the bullshit proofs like "1=2" or "the missing dollar" It's all a bit of misdirection designed to confuse idiots. Here, you're using types to do the misdirection:

      for a = b you have "abc" == true which is evaluated as true == true // true
      for a = c you have "abc" == 0 which is evaluated 0 == 0 // true
      for b = c you have true == 0 which is evaluated as 1 == 0 // false

      The first premise comparing two booleans, the next two are evaluating two integers. It's all a bit of misdirection, as it ultimately says NOTHING about the relationship between a,b, and c because a,b, and c are not identical between each premise. Mathematically, your "proof" doesn't make any fucking sense at all.

      Fixing it so the types you actually compare match gives you:
      for a = b you have "abc" == 1 which is evaluated as 0 == 1 // false
      for a = c you have "abc" == 0 which is evaluated 0 == 0 // true
      for b = c you have 1 == 0 which is evaluated as 1 == 0 // false

      As you can see, a = b is false when the types are ints and not bools.

      Given a != b and a = c we assume that b != c (Look at that, b != c. It works just fine!)

      Take away the bullshit, and your "proof" vanishes in a puff of logic.

      Now go and sin no more.

    193. Re:Really? by jbezorg · · Score: 1

      You can make PHP scream every mistake to the output buffer with the following.

      Within code if you can't change php.ini
      ini_set('error_reporting', E_STRICT | E_ALL); // or error_reporting( E_STRICT | E_ALL );
      ini_set('display_errors', 1);

      Or within php.ini
      http://us.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
      http://us.php.net/manual/en/errorfunc.configuration.php#ini.display-errors

      --
      I've lost all my marbles except one & It's fun to test angular & centripetal acceleration in my skull
    194. Re:Really? by allo · · Score: 1

      and that's, whats making php such a cluttered piece of shit.

    195. Re:Really? by allo · · Score: 1

      yeah, and with weak types, "1"+"1" might be 2, but "1"+"" should better be undefined.

    196. Re:Really? by beelsebob · · Score: 1

      Your example is bullshit. It's just like the bullshit proofs like "1=2" or "the missing dollar" It's all a bit of misdirection designed to confuse idiots. Here, you're using types to do the misdirection:

      for a = b you have "abc" == true which is evaluated as true == true // true
      for a = c you have "abc" == 0 which is evaluated 0 == 0 // true
      for b = c you have true == 0 which is evaluated as 1 == 0 // false

      The fact that the evalutator internally evaluates these as different types from the ones you typed does not magically mean that it suddenly has a transitive equality operator. It merely means that what the evaluator does inside is retarded, and causes transitivity not to hold. Transitivity cares not for the internal implementation. It is a simply statement of fact... If there exists an a,b,c such that a op b && b op c && not(a op c) then op is not transitive.

      op in this case is not transitive, because it breaks that rule. The fact that things internally are bat shit crazy does not change that fact.

    197. Re:Really? by mwvdlee · · Score: 1

      Cluttered; yes.
      Piece of shit; no.

      There's a cluttered bathroom with a clean sink and an unflushed toilet. Don't blame the bathroom if you choose to wash your hands in the toilet.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    198. Re:Really? by narcc · · Score: 1

      Sigh, I guess math isn't your strong suit!

      That the operator does the type conversion for you is completely irrelevant. == is transitive. Remember, you can't test two values for equality if they're different types! (They're members of different sets that do not intersect, after all.) You'll get the exact same behavior in any other language if you do the type conversion yourself. Does that mean == in statically typed languages isn't transitive? Of course not!

      The fact that things internally are bat shit crazy does not change that fact.

      Lol, if by "bat shit crazy" you mean both well defined and completely obvious. Had you paid attention in logic 101, you wouldn't have parroted such a ridiculously bad "proof". I mean, it's pretty obvious on it's face that it's nonsense. I'm astonished that you thought it was legitimate -- I had thought you either copy/pasted it without thinking, or just thought you could pull a fast one!

      what the evaluator does inside is retarded, and causes transitivity not to hold

      No, it's not retarded. It's EXACTLY what you'd expect if you did the type conversion yourself! That the operator does it for you out of convenience is irrelevant. Why does it do any conversion? Because you can't test values of different types for equality!

      Clearly, your play-pretend "proof" which is, as I've painfully explained to you, complete and total nonsense mathematically. Why are you still defending it? It's dead. It should be clear to you by now that it's neither mathematical nor a proof.

      Copy/paste a better argument; preferably one that's legitimate. This one doesn't work, your "mathematical proof" is neither, and I'm tired of explaining simple shit to you.

    199. Re:Really? by omnichad · · Score: 1

      Except in JavaScript, where "1"+"1" is "11" and "1" + "" is 1.

    200. Re:Really? by Anonymous Coward · · Score: 0

      No, it's not retarded. It's EXACTLY what you'd expect if you did the type conversion yourself! That the operator does it for you out of convenience is irrelevant.

      It's entirely relevant. The type conversion is part of the behaviour of the == operator, and the type conversion make it not transitive, therefore the == operator is not transitive.

    201. Re:Really? by narcc · · Score: 1

      Let's say that I grant that particular absurdity. This is what we get:

      == is transitive over any scalar type, like every other language.

      Even cooler, it is transitive over any two scalar types -- that means it's transitive over more combinations of types than most other languages where == does type conversion.

      The most you can say is that it is not transitive over three or more scalar types simultaneously. Fine, but then again, neither is == in any other language!

      His nonsense "proof", of course, is still embarrassingly wrong.

      Let's hope this puts this particular waste of everyone's time to rest.

    202. Re:Really? by Anonymous Coward · · Score: 0

      The most you can say is that it is not transitive over three or more scalar types simultaneously.

      So you finally agree that it's not transitive.

      His nonsense "proof", of course, is still embarrassingly wrong.

      The proof is perfectly valid.

    203. Re:Really? by Anonymous Coward · · Score: 0

      Even cooler, it is transitive over any two scalar types

      Actually, even that isn't true:

      $ php
      <?php
      $a = "0";
      $b = 0;
      $c = "z";
      echo '$a == $b: '.($a == $b ? 'true' : 'false')."\n";
      echo '$b == $c: '.($b == $c ? 'true' : 'false')."\n";
      echo '$a == $c: '.($a == $c ? 'true' : 'false')."\n";
      ?>
      $a == $b: true
      $b == $c: true
      $a == $c: false

      Only two types involved, and it's not transitive.

    204. Re:Really? by Anonymous Coward · · Score: 0

      Lol, if by "bat shit crazy" you mean both well defined and completely obvious.

      Do you consider it "completely obvious" that

      "0" == "0.0"

      does a numeric comparison, but

      "0" == "0.0z"

      does a string comparison? (Note, both values are strings in both cases, it's just the content that varies.)

    205. Re:Really? by allo · · Score: 1

      read TFA for the "piece of shit" part. He's linking the relevant postings on this.

    206. Re:Really? by Anonymous Coward · · Score: 0

      So you finally agree that it's not transitive.

      Transitivity is only meaningful when comparing values of the same type. The type conversions must be done before the comparison can be made. Type conversions have nothing to do with the transitivity of the operator.

      You can't make type conversions 100% transitive. Look at string-to-number conversion for example. There is no way to guarantee a round trip from "abz" to integer back to "abz." If you can find an example of any programming language that can do what you're asking, I'll give you a shiny new quarter.

    207. Re:Really? by beelsebob · · Score: 1

      Transitivity is only meaningful when comparing values of the same type. The type conversions must be done before the comparison can be made. Type conversions have nothing to do with the transitivity of the operator.

      No transitivity has meaning for any binary operator, whether it does type conversion or not. In this case, the == operator does, and transitivity does not hold. And no the type conversions must not be done, there's an alternative – declare programs that require such conversions to be illegal. That would be a far more sane approach. Notably, it's the approach taken by python, which rather negates your point that this is systemic to dynamically typed languages... It's not, it's systemic to languages with broken type systems.

    208. Re:Really? by Anonymous Coward · · Score: 0

      Transitivity is only meaningful when comparing values of the same type.

      [citation needed]

      The type conversions must be done before the comparison can be made.

      Whether the operator does type conversions (or any other intermediate step) internally is irrelevant to the definition of transitivity.

      Type conversions have nothing to do with the transitivity of the operator.

      That's true - transitivity only cares about the observable behaviour of the operator, and == in PHP is observably not transitive.

      You can't make type conversions 100% transitive.

      Transitivity is a property of a binary relation (in programming, usually rendered as a binary operator that returns true or false), not a conversion, so your statement makes no sense.

    209. Re:Really? by beelsebob · · Score: 1

      Both, a sane language (even a sane dynamically typed one) simply declares these expressions to be illegal. Note – dynamically typed does not imply weakly typed.

    210. Re:Really? by Anonymous Coward · · Score: 0

      mysql_escape_string and mysql_real_escape string are both useful, depending on whether you have an SQL connection open.

    211. Re:Really? by Phroggy · · Score: 1

      PHP is well documented. in another reply, I provided a link to the number_format function.

      it expects a float, not a null or a string. the documentation is very clear.

      Sure, the documentation says you're supposed to pass it a number. It doesn't say what will happen when you pass something that is not a number. The behavior that I would expect is one of two things:
      1) the script should crash because I tried to pass the wrong type of data, or
      2) whatever crazy thing I tried to pass should be automatically converted into a number

      And indeed, the previous behavior was #2. The new behavior is neither of these, and does not appear to be documented.

      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
    212. Re:Really? by Anonymous Coward · · Score: 0

      It's simple. The function takes a float argument. If you pass it a string, the string will be cast to a float before the function performs any actual analysis on it.

      As you can see from the PHP manual, string conversion to number emulates the behavior of the Unix strtod(3) function; according to the man page for strtod(3), "If no conversion is performed, zero is returned".

      So if an argument is passed which can't be converted to a number (e.g. empty string), the argument is converted to zero.

    213. Re:Really? by Anonymous Coward · · Score: 0

      Fork?

      Fork You!

      Potty mouth!

  3. Fixing PHP brokeness by Ziest · · Score: 1

    Yeah, lets start by making PHP case sensitive.

    --
    Another day closer to redwood heaven
    1. Re:Fixing PHP brokeness by wonkey_monkey · · Score: 1

      Which particular bit that isn't are you thinking of?

      --
      systemd is Roko's Basilisk.
    2. Re:Fixing PHP brokeness by Anonymous Coward · · Score: 0

      function and method names are not case sensitive.

    3. Re:Fixing PHP brokeness by Anonymous Coward · · Score: 0

      IMHO, any half decent developer should be consistent when he/she codes. Making sure that your casing is consistent (regardless of language) yourself instead of depending on syntax highlighting or compile/run time errors is par for the course.

  4. People do something about it EVERY DAY. by Anonymous Coward · · Score: 0

    [...] and while everybody seems happy to complain about it, nobody seems willing to do anything about it.

    People do something about it EVERY DAY: they use something else.

  5. PHP is brilliant by Anonymous Coward · · Score: 0

    Rubbish - PHP is brilliant.

    1. Re:PHP is brilliant by LQ · · Score: 1

      Rubbish - PHP is brilliant.

      I have to agree that for some small jobs, PHP is just the right tool.

  6. Marketing Campaign! by CriminalNerd · · Score: 0

    The best way to fix the PHP problem at this point is to make the alternatives so outstanding that the choice of the better hammer becomes obvious.

    I think he's proposing that somebody starts a marketing campaign to trick/convince all the PHP developers to switch to something better because clearly, Outstanding = Great PR.

    I hear that this Streisand guy does a great job of bringing things to the attention of the general public; he'd be perfect for the job.

  7. Fix? I think you mean, "migrate" by betterunixthanunix · · Score: 1, Insightful

    It is not as though there is no other choice. The only two things that need to be done are (a) stop writing new PHP code and (b) start migrating old PHP code to better languages. We can do web development in Python, Haskell, various Lisps, Scala, and several others. There is no "fixing" necessary, just phasing out -- and the only code related to PHP that needs to be written, if any, would be interfaces for better languages, so that old, impossible-to-rewrite code can be extended with something that is not PHP.

    --
    Palm trees and 8
  8. if php is broken what is javascript? by Anonymous Coward · · Score: 4, Interesting

    if php is broken what is javascript?

    1. Re:if php is broken what is javascript? by Ziest · · Score: 3, Insightful

      if php is broken what is javascript?

      A disaster.

      --
      Another day closer to redwood heaven
    2. Re:if php is broken what is javascript? by Anonymous Coward · · Score: 2, Funny

      Client-side misery.

    3. Re:if php is broken what is javascript? by Anonymous Coward · · Score: 0

      Exactly.

      Lua is better and has been around for ages. Very stable, simple, powerful, and faster than everything else (LuaJIT is probably the fastest scripting language ever made).

    4. Re:if php is broken what is javascript? by Anonymous Coward · · Score: 1

      A nice language with shitty syntax

    5. Re:if php is broken what is javascript? by Anonymous Coward · · Score: 0

      Malicious.

      Slow down cowboy. You're capable of typing pithy replies faster than we ever conceived.

    6. Re:if php is broken what is javascript? by ggpauly · · Score: 3, Insightful

      The World's Most Misunderstood Programming Language

      http://javascript.crockford.com/javascript.html

      --
      Verbum caro factum est
    7. Re:if php is broken what is javascript? by Anonymous Coward · · Score: 1

      >if php is broken what is javascript?

      Slightly less broken, but infinitely less replaceable with something better. What alternative do we have for rich interfaces on the web?

    8. Re:if php is broken what is javascript? by Korin43 · · Score: 2

      if php is broken what is javascript?

      Still better than PHP?

    9. Re:if php is broken what is javascript? by Anonymous Coward · · Score: 0

      Reliable. Robust. Easily debugged. Mostly consistent and mostly free from quirks.
      All this, despite being developed by multiple separate groups each with their own goals and a horrible terrible spec they had to work with in the beginnings.
      Honestly, I am surprised there aren't anymore quirks.

      JS has a few quirks between each of the browsers, in particular input handling, CSS management, few DOM edge cases here and there.
      That crap can be wrapped up in a function to handle those quirks easily.
      And since it is in active development, all the vendors, EVEN Microsoft, have agreed to using browser prefixes on to their implementations of working specs to work out the quirks before everyone agrees on what the future of the defined spec would be.
      The mess caused by YOU KNOW WHO is now being fixed because the community at large took control, they were fed up with them wrecking everything with their sloppy specs. In the past 5 years so much has changed, far more than all the years before it from the very beginning. The fact that Microsoft is actually taking an active stance in the browser spec development says a lot.

      That simply cannot happen with PHP anymore. Too many people are happy dealing with a language full of horrible quirks, horribly inconsistent code parsing based on how you compiled the language in the first place (TERRIBLE IDEA), horrible to debug, not robust in the slightest, so just not reliable at all.
      PHP is hilariously more broken than JavaScript.

      However, I will agree with some requests for the ability to use any scripting language with a browser.
      You can still do it, but it is more painful than setting up some JS.
      And you can even make both of them work on the same page at the same time if you really wished to.
      I guess the good part is at least there is some sense of scripting available by default.
      Then if you really absolutely had to have another scripting language, or if you wanted to make users know that the site would run faster by installing it, you can just do so.
      Serve both a JS file and, say, a Lua file.
      I'm not sure how you'd go about inter-script communication, though. I guess the only way I can think of would be the DOM since that would be common. (but horribly slow, even now)

      With the app age coming to browsers, this will likely become more common as people try to squeeze out even more speed.
      Either that or things like Native Client will come out on top so we can just serve that.
      Hopefully not. Then we will be back in the 90s.

    10. Re:if php is broken what is javascript? by Anonymous Coward · · Score: 0

      A persisting apocalypse, certian to bring about the end of web browsing as we know it?

    11. Re:if php is broken what is javascript? by canadiannomad · · Score: 2

      The World's Most Misunderstood Programming Language

      http://javascript.crockford.com/javascript.html

      I strongly agree with this. Most people who complain about JavaScript never fully learned it, and hate the DOM (the DOM isn't really JavaScripts fault)
      I've been working with Node.js for a while, and love it compared to PHP. It's faster too, and my code can run client or serverside depending on the needs/abilities of the browser, bonus!

      --
      Hmm, the humour and sarcasm seem to have been be lost on you.
    12. Re:if php is broken what is javascript? by VGPowerlord · · Score: 3, Interesting

      if php is broken what is javascript?

      If you've ever played Secret of Monkey Island, look at the poster of the woman near the bar.

      "When there's only one candidate, there's only one choice."

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    13. Re:if php is broken what is javascript? by shutdown+-p+now · · Score: 0

      It's a strawman. Many people who complain about JS hate JS because of numerous inconsistencies in the language itself that has nothing whatsoever to do with DOM or any other third-party API. It's things like scopes of local and global variables (and having to do a crazy dance to avoid polluting the global namespace), or how it pretends to look like C but then sneaks semicolons into random places, or the separation between primitive types and OO wrappers (which made little sense in Java, but none whatsoever in a dynamically typed language like JS), and many, many other things.

      That said, it still can't beat PHP for the title of the worst designed language still in use.

    14. Re:if php is broken what is javascript? by canadiannomad · · Score: 1

      If you're doing a crazy dance with the global namespace, you are doing it wrong. Function scope works if you understand it. It isn't C, stop comparing it to C, really has nothing to do with C. Why are you leaving out semicolons, that is bad practice. Most of the inconsistencies are automatically worked around by the major frameworks, or by avoiding stupid functions that don't make sense. I have to give you the bit about the primitives, but the coercion between primitives and their object equivalents has never been an issue for me, and usually is just a convenience. My biggest pet pieve is inconsistant truthiness, usually soved by copious use of === instead of == .

      --
      Hmm, the humour and sarcasm seem to have been be lost on you.
    15. Re:if php is broken what is javascript? by martijnd · · Score: 1

      if php is broken what is javascript?

      A disaster.

      Somewhere a divine being is smiling wickedly and realizes all is well -- Javascript is pretty much on its way to become the most frequently used programming language on the planet, ever.

      It surely is the best available ; nearly every computer on the planet has a debugger for it available.

    16. Re:if php is broken what is javascript? by shutdown+-p+now · · Score: 2

      If you're doing a crazy dance with the global namespace, you are doing it wrong. Function scope works if you understand it.

      Using a lambda that is called immediately just to create a new scope is a hack, plain and simple.

      It isn't C, stop comparing it to C, really has nothing to do with C.

      I'm not comparing it with C. I'm comparing it with every other language out there that has the same features. They all do it the same way, except for JS.

      For example, the only language that has similarly stupid scoping rules (where the scope of any local is the entire function, even if it's declared inside a nested block) for locals as JS is VB6. But at least VB6 didn't have closures!

      Why are you leaving out semicolons, that is bad practice

      You miss the point. I'm not leaving out semicolons, I like them where I put them. The problem with JS is that it will silently and automatically put semicolons in certain places where it thinks that I've missed one, where I actually did not. The most common example is:

      return
      {
        foo: "bar";
      };

      It'll insert a semicolon after "return", even though I don't want it there. Again, it's the only curly braces language that does anything like that.

    17. Re:if php is broken what is javascript? by Anonymous Coward · · Score: 0

      if php is broken what is javascript?

      A disaster.

      Here's proof:

      In PHP, you can specify the type of an object, which will be used to provide a run-time type check.

      In JavaScript, you have no such option to do that. If you want type safety in JavaScript, you'll have to invent and implement it all yourself, probably with some kind of "assert()"-like coding discipline.

      Our Engineering group recently made a major decision to reject JavaScript as a candidate language for our next-gen platform. That decision turned entirely on the lack of the option of convenient type safety. It was a very worrisome decision for us because of the fact that everyone else seems to be plunging full-steam-ahead into the world of HTML5/JavaScript. But we looked at the long-term implications of developing a huge code-base of un-type-checkable code, and we just couldn't do it.

      This was a mirror of what we when through with PHP a few years ago. We were just about ready to switch away from PHP when they announced that they would support run-time type checks for objects -- and that convinced us that we didn't have to abandon PHP.

      Yes, type safety is a big, big deal. At least for large projects it is.

    18. Re:if php is broken what is javascript? by thetoadwarrior · · Score: 1

      Broken++

    19. Re:if php is broken what is javascript? by narcc · · Score: 1

      Using a lambda that is called immediately just to create a new scope is a hack, plain and simple.

      Holy shit, I actually agree with you! (Well, almost. It sure as hell feels like a hack, like I'm doing something horribly wrong.)

      There are other ways to limit polluting the global namespace. The module pattern is just plain bad.

    20. Re:if php is broken what is javascript? by Anonymous Coward · · Score: 0

      More like a nice object model with a shitty language

    21. Re:if php is broken what is javascript? by Anonymous Coward · · Score: 0

      > if php is broken what is javascript?

      a client-side scripting language.

  9. and by Anonymous Coward · · Score: 3, Insightful

    if one is happy with PHP and has still not encountered peculiar problems?

    1. Re:and by Anonymous Coward · · Score: 0

      Ignorance is bliss.

    2. Re:and by rev0lt · · Score: 1

      You still haven't written any code. Keep reading that hello world tutorial. :D

    3. Re:and by billcopc · · Score: 3, Insightful

      Welcome to the club.

      Some of us are getting shit done with PHP. To me, that's all that matters. If all these whiners got together, forked PHP into something cleaner and faster and posted THAT to their shitty blogs, I'd be all over it.

      Programming isn't about having the prettiest language. It's about accomplishing whatever it is you need accomplished, using whichever tool gets you there in the most efficient manner. These "solutions" provided by PHP haters are the equivalent of saying "I'm scared of big trucks, so here's a purple unicycle driven by an albino puppy who can bark the first 400 digits of Pi in reverse", when the problem was "I gotta move 83 tons of unobtainium from here to there by Tuesday".

      --
      -Billco, Fnarg.com
    4. Re:and by Jamu · · Score: 1

      I'm reminded of this recent video.

      --
      Who ordered that?
    5. Re:and by shutdown+-p+now · · Score: 1

      Follow the link in my sig, read, and weep.

      I can provide directions to your nearby "PHP Coders Anonymous" meeting place after you follow up.

    6. Re:and by Anonymous Coward · · Score: 0

      >It's about accomplishing whatever it is you need accomplished, using whichever tool gets you there in the most efficient manner.

      In a clean and maintainable way. I write code that I expect to last 10-20 years. To last that long, people that come after me need to be able to modify it easily and quickly. If you are writing throw-away junk, then yes, cut-and-paste your way to success as quickly as possible.

      I admit, I have a disdain for weakly typed languages.

    7. Re:and by Anonymous Coward · · Score: 0

      Well said. My favorite part of PHP is that is free and there is plenty of documentation and examples out there to get done what you need to get done. It's far from perfect - but I didn't pay for it, so if I have a problem with it, I should fork it or shut up :)

    8. Re:and by Anonymous Coward · · Score: 0

      For all the people sniveling about how terrible PHP is, let me say this:

      I'm a PHP programmer. I love it. I've used PHP to create sites that work beautifully and that have made me hundreds of thousands of dollars over the last few years. It's free, it works, and it lets me get stuff done. Yes, PHP has made me a shitload of money.

      So all you Ruby/ROR/Python etc coders, complain all you want. Have at it, boys! While you're dicking around with your FABULOUS language that's SO FUCKING WONDERFUL, I'll be doing shit and making money.

    9. Re:and by tibit · · Score: 1

      There's plenty of better and arguably faster software development platforms than PHP, that let you accomplish stuff more efficiently if you actually know the tools in question. If all you know is PHP and you insist that it's the only thing you can ever spare any of your precious time to learn, then there's no way you'll ever realize there are better tools out there. It's the classic chicken-and-egg problem: you won't learn because you have no time to learn because you're so busy with busywork.

      You're completely occupied billing for your busywork on a clusterfuck of a platform, getting "things done". A popular platform, admittedly, but a clusterfuck nevertheless. Your idea of "getting things done" must be vastly different from how people who really get shit done get shit done. Busywork surely gets you towards getting shit done, but just imagine that there might be a way where there's comparatively no busywork and you're just doing the "shit done" part without the "getting" part. As much as I'm no MS fanboy, even most rudimentary ASP.NET or contemporary is miles ahead in productivity compared to what PHP offers out-of-the-box (with no other frameworks on top of it). Heck, even JSP offers a much cleaner, faster and consistent environment from PHP.

      --
      A successful API design takes a mixture of software design and pedagogy.
  10. Perhaps it is not broken and horrible by Anonymous Coward · · Score: 4, Insightful

    PHP is a language for getting thing done. Just like any toolbox, you can build great or terrible things with it. It's like perl in that way (and I've done plenty of both). If you code well, there's very little to complain about with PHP. I've hired java guys onto my php projects before, and they were up and running in a week or so because we were coding with some structure instead of slapping together hacks.

    And personally, I wouldn't want it any other way. I don't want language designers deciding they know what I want to do better than me. What I want, is the flexibility to build things as I see fit, and to do so quickly. Production is my goal. If you can help me build my projects elegantly/etc, then great, but getting it built quickly is always my priority.

    1. Re:Perhaps it is not broken and horrible by MightyMartian · · Score: 1, Insightful

      It's a broken tool that one has to put a considerable amount of effort into to write tolerably decent apps. It's libraries couldn't be worse than if someone took a print out of the specs, stuck dynamite in the middle and then tried to reassemble them. Coding in PHP has got to be one of the miserable experiences I have had, the only thing being worse is trying to fix someone else's PHP code.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    2. Re:Perhaps it is not broken and horrible by Anonymous Coward · · Score: 3, Informative

      PHP is a language for getting thing done. Just like any toolbox, you can build great or terrible things with it. It's like perl in that way (and I've done plenty of both). If you code well, there's very little to complain about with PHP.

      I might be misinterpreting you here, but this sounds like a point responsed to in PHP: A Fractal of Bad Design:-

      Do not tell me that "good developers can write good code in any language", or bad developers blah blah. That doesn't mean anything. A good carpenter can drive in a nail with either a rock or a hammer, but how many carpenters do you see bashing stuff with rocks? Part of what makes a good developer is the ability to choose the tools that work best.

      You also said:-

      And personally, I wouldn't want it any other way. I don't want language designers deciding they know what I want to do better than me.

      I also think the problem a lot of people have with PHP is its inconsistent and illogical bad design, which isn't the same thing as flexibility. I don't think having a logically designed language necessarily means one that forces its philosophy on you. I'll note that the fractal post referenced above also states that:-

      I assert that the following qualities are important for making a language productive and useful, and PHP violates them with wild abandon. If you canâ(TM)t agree that these are crucial, well, I canâ(TM)t imagine how weâ(TM)ll ever agree on much.

      * A language must be predictable. Itâ(TM)s a medium for expressing human ideas and having a computer execute them, so itâ(TM)s critical that a humanâ(TM)s understanding of a program actually be correct.

      * A language must be consistent. Similar things should look similar, different things different. Knowing part of the language should aid in learning and understanding the rest.

      * A language must be concise. New languages exist to reduce the boilerplate inherent in old languages. (We could all write machine code.) A language must thus strive to avoid introducing new boilerplate of its own.

      * A language must be reliable. Languages are tools for solving problems; they should minimize any new problems they introduce. Any âoegotchasâ are massive distractions.

      * A language must be debuggable. When something goes wrong, the programmer has to fix it, and we need all the help we can get.
       

      (Apologies for the cut-and-paste splotches, but I don't have time to fix them right now)

    3. Re:Perhaps it is not broken and horrible by Anonymous Coward · · Score: 0

      PHP is a toolbox alright. With tools like this:

      http://farm8.staticflickr.com/7226/7095238893_5000f6e57d_m.jpg

    4. Re:Perhaps it is not broken and horrible by Anonymous Coward · · Score: 0

      PHP is a language for getting thing done. Just like any toolbox, you can build great or terrible things with it. It's like perl in that way (and I've done plenty of both).

      And look at where Perl is being used still. PHP will go the way of perl, for the many of the same reasons.

    5. Re:Perhaps it is not broken and horrible by Jesus_666 · · Score: 2

      PHP is a screwed-up language. However, it's a screwed-up language that is very easy to get into. It's the Basic of web development languages. In order to compete, your language must be more straightforward than Basic - at least as far as beginners are concerned. While frameworks like Django or Rails are very nice and automate a lot of stuff, they are much more complex than "write 'echo $bar' to output some text". That's why PHP has such a solid grasp of the beginners' market: One file with three lines (two of which are boilerplate) is all you need to get a working Hello World implementation and it's obvious how to progress from there. "One file, one script" is messy but easy to get started with.

      And, of course, other languages are not free from utter nonsense, either. For instance, Python can convert base-n numerical strings (with 1 <= n <= 36) to integers but it can only convert integers to numerical strings of the bases 2, 8, 10 and 16. Why? Nobody knows. Of course Python doesn't get anywhere near PHP's level of idiosyncrasy but the combination of "unlike PHP, $LANGUAGE is consistent"-type rhethoric and inconsistencies in the language does turn one off when trying to move away from PHP. (Although in my case it was just a small part of a general incompatibility between me and Python; I seem to mesh better with Ruby, though.)

      Before someone asks why I needed to generate arbitrary-base numeric strings: Legacy interfaces.

      (I'd also like to mention that PHP is debuggable with a third-party extension. If third-party extensions don't count then Python and Ruby aren't web languages; neither Django nor Rails are part of the default package. In fact, AFAICT Python and Ruby also require third-party packages for remote debugging support.)

      --
      USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)
    6. Re:Perhaps it is not broken and horrible by mikael_j · · Score: 1

      Thanks, but I'll stick to C#. Sure, it may take me 30 more keystrokes than one of these open source languages to write a super-simple program, but when I'm not around in 2 years and someone else has to look at it, they'll understand exactly what it's supposed to do and know unambiguously how it works.

      Clearly someone has never inherited a web application built in C#.NET by someone with a CS degree who still failed to understand basic things like code formatting, "god classes are bad" and that there is such a thing as character encoding. Also, this project included those wonderful chains of method calls where it would feed data into one function which would call another function which would call another function which would call another function until finally another function would do some minor change and return the result encapsulated in a brand new spiffy object containing a ton of other unnecessary crap that would be discarded (and this type of object was of course only used for this particular purpose).

      The whole project was a total mess and the core functionality barely worked on a very narrow subset of web browsers (specific versions of IE due to various HTML and JS screwups). In the end the entire thing had to be scrapped and rewritten because it was such a garbled mess of code.

      That project was to me a great example of how it's not just that a good developer can write good code in most environments but also that a bad developer can produce horrible code in any environment.

      --
      Greylisting is to SMTP as NAT is to IPv4
  11. Re:Fix? I think you mean, "migrate" by JDG1980 · · Score: 3, Interesting

    It is not as though there is no other choice. The only two things that need to be done are (a) stop writing new PHP code and (b) start migrating old PHP code to better languages. We can do web development in Python, Haskell, various Lisps, Scala, and several others.

    None of these languages use standard C-style syntax. That syntax is one of several reasons why PHP is so ubiquitous: any reasonably competent C/C++/Java programmer can adapt to it quickly.

  12. Good programmer = good PHP code by Anonymous Coward · · Score: 4, Insightful

    Any good programmer will be able to make awesome PHP code. Bad PHP written applications are just the result of lack of passion, knowledge, and in some cases don't forget it, pressure from the customer. Combine bad programming skills, no experience with other OOP languages, pressure and "I don't care how it is done, I've done it and it works that's enough"... and you get the result. I'm tired to read and hear that PHP is shit. -- ParaBug

    1. Re:Good programmer = good PHP code by hugortega · · Score: 2

      ... and that's true for ANY other language. The main problem is about bad developers, not bad languages.

    2. Re:Good programmer = good PHP code by Anonymous Coward · · Score: 0

      Any good programmer will be able to make awesome PHP code.

      And I'm sure the same good programmer will re-write awesome PHP code to replace the deprecated shit when an upgrade comes out...

    3. Re:Good programmer = good PHP code by defcon-11 · · Score: 4, Insightful

      No, to write good PHP code you have to be both a good coder and a PHP expert, otherwise its inconsistencies and corner cases will bite you in the ass. On the other hand, a good coder can write good code in Python, Ruby, .net, and java, because those languages generally do what you expect them too, and you're not going to accidentally open a massive security flaw by having an incorrect setting in php.ini or forgetting to pass the right parameters into get_file_contents.

    4. Re:Good programmer = good PHP code by Anonymous Coward · · Score: 0

      You shouldn't need to have experience with terrible quirks. (disguised as weak-typing, it gives a bad name to weak-typing!)
      You shouldn't need to know how the interpreter was compiled in order to change the behaviour of scripts.
      You shouldn't need to throw away common things that every other language in existence has used and only PHP seems to have gotten wrong. (many operator bugs)
      Nobody should EVER have a passion for learning bad things. That is destructive.

      PHP is bad. It doesn't matter if it is a good developer or a bad developer. PHP is just plain awful.
      The fact you needed to call the code awesome speaks more than the rest of your post.
      This tired excuse is used time and time again to defend that broken language.

      PHP is:
      inconsistent
      unreliable
      not robust
      capable of being compiled with different flags that seriously changes how the language parses and deals with operators.
      and due to the above, sometimes damn near impossible to debug easily without having to learn a stupid list of quirks
      PHP fails on some of the main reasons you'd ever use something.
      Would you seriously put your money where your mouth is and use PHP on a mission-critical setting, if you could? (ignore the fact it is interpreted)
      I sure wouldn't. I know for a fact that lives would be lost due to it.

      The ONE good thing PHP has is that it is fairly fast to get something together due to how much documentation and libraries are out there that already deal with these horrible quirks.

    5. Re:Good programmer = good PHP code by Anonymous Coward · · Score: 0

      You can write bad code in any language, but some languages make it easier than others.

    6. Re:Good programmer = good PHP code by Anonymous Coward · · Score: 0

      If the language actively misinterprets you and you have to play a lawyer in court to make it fucking understand, it annoys programmers and we are right bitching about it.

    7. Re:Good programmer = good PHP code by Anonymous Coward · · Score: 0

      Yea, those corner cases really bite me in my ass with all of my Wordpress sites.

      Wait. That never happens.

    8. Re:Good programmer = good PHP code by Anonymous Coward · · Score: 0

      No, to write good PHP code you have to be both a good coder and a PHP expert

      So basically, PHP is shit because you're not a PHP expert. That's PHP's fault?

  13. a small and simple php script interpreter? by staalmannen · · Score: 1

    Is anyone aware of an alternative php interpreter that does not require tons of external dependecies? I have been playing with porting various stuff to less usual operating systems and PHP has definitely been one of the most dificult things I have undertaken. It requires quite a lot of other packages to first be ported.

    1. Re:a small and simple php script interpreter? by Richard_at_work · · Score: 1

      You could look at Facebooks HipHop tool, transforms PHP syntax into C/C++.

    2. Re:a small and simple php script interpreter? by rev0lt · · Score: 1

      Well, most dependencies are module-related. You don't really need "modules" to build the basic interpreter. In fact, that is the way of doing things in FreeBSD (the PHP interpreter is standalone from all the modules, and each module is a separate port). Have a look at their ports tree and the supplied makefiles, it may give you some hints.
      If the less usual operating systems you are porting to are unix-like, you may also try to use Pkgsrc (http://www.netbsd.org/docs/software/packages.html#platforms), a muti-platform ports tree.

    3. Re:a small and simple php script interpreter? by staalmannen · · Score: 1

      Thanks! The FreeBSD port may definitely give some hints and according to it, the number of dependencies are lower (http://www.freebsd.org/cgi/ports.cgi?query=^php53-5.3.14&stype=name). One of the OSes that I try to build in is Plan9 with APE (ANSI POSIX ENVIRONMENT) and then some of those things are also not part of it, but I have managed to go through the configure phase so it might be possible. I do however have to generate mkfiles myself and the BSD makefiles did not seem to give information about the minimal core in the sources to generate the "php" binary. I am suspecting the "main" directory and "sapi/cli" and possibly "ext/posix" to be part of the absolute minimal core. Anything else? Another system I am looking at is a musl libc-based linux system.

  14. Obligitory by ArhcAngel · · Score: 2, Insightful
    --
    "A person is smart. People are dumb, panicky dangerous animals and you know it." - K
  15. PHP has only its members to blame by mlwmohawk · · Score: 4, Interesting

    Years ago I was involved with PHP, and the core developers have no real interest in making anything better, or, more specifically, accepting any criticism. I'm not the only developer to be pissed off when decisions are made "off line" and passed down. There was no sense of community. In conversations with other would be contributors, the general consensus was the PHP was headed up by a bunch of pissy children.

    Don't get me wrong, I think PHP is a powerful environment and a lot of things have been done with it, but it suffers from a lack of rigour. If they could decide *what* the hell the language wanted to be, that would be helpful. If they could clean up the extensions API that would be helpful too. PHP's extensions are so powerful but there is no abstraction, your extension is essentially a PHP internal module.

    All in all, PHP has had power and potential for years, but the reason why ruby even had a shot was that the PHP project can't get its act together to address, or even acknowledge, its short comings.

  16. PHP alternatives by Compaqt · · Score: 5, Interesting

    The one big redeeming feature of PHP is you set up a single DB server (or even multimaster) plus multiple webservers, and bam! You're sharing objects/sessions among the webservers. Doesn't matter what webserver the next request hits, the session's there.

    By contrast, that simple thing is something that other environments struggle with. I remember ads for "Share Java POJOs" as if that was a huge deal, and the CEO of some firm that did that said people told him that was a godsend. I'd imagine it's the same for Python and Ruby.

    1. Java. Huge memory footprint. Admins hate it because it doesn't conform to certain Unix conventions.

    Try this: Download any one of a number of open-source Java CMSs or ERM systems. Then watch the Java exceptions flow down your console screen. Good luck figuring them out. Static analysis rules, except when it doesn't.

    Java's great if you're writing an desktop app for geologists trying to find oil or a backend bank system. For your average, ho-hum, billion-dollar website: not so much.

    2. Ruby: You go to war with the webserver they give you, not the one you want.

    3. Python: Great language and library. A shame it was hobbled by the whitespace issue, which meant that some programmers didn't check it out who should have. Anyway, it's hard for Beta to get traction against VHS.

    Anotherwords, PHP is good enough. "Worse is better."

    Since the three environments above are monolithic, if there's a problem, it's a problem for every client logged in. PHP, by contrast, follows a Unix minimalist philosophy: if a PHP FCGI instance (or even an Apache mod_php instance) crashes, it's just that one instance. No problem, user hits F5, reloads, PHP's stateless, you get the session back, keep calm and carry on.

    When Marc Zuckerberg or a number of other entrepreneurs started hacking out Facebook, they started out with PHP, just because it's light and fast, and easy to get something up on the wall. Nobody cares about the elegance of Python or Ruby, it's all about time to market.

    Finally, nothing about "you can't debug PHP", in today's discussion, please. You can very well step through PHP code. Use Netbeans and something like xdebug. Or Eclipse.

    PHP: Paraphrasing Churchill, it's bad, but the alternatives are worse.

    --
    I'm not a lawyer, but I play one on the Internet. Blog
    1. Re:PHP alternatives by Richard_at_work · · Score: 1

      Most languages can store session data out of process these days...

    2. Re:PHP alternatives by codepunk · · Score: 3, Insightful

      The biggest problem I have with python is that it spoils me. Writing python for a couple of weeks then having to jump back into a C syntax language causes me pain. It takes a few days again to get over the fact that I am constantly having to type cruft just so the compiler knows what I mean.

      --


      Got Code?
    3. Re:PHP alternatives by phantomfive · · Score: 2

      I think you've basically made his point. PHP is painful, but it sticks around because of the difficulties in the alternatives.

      He is trying to say that improving the alternatives is easier than fixing PHP.

      --
      "First they came for the slanderers and i said nothing."
    4. Re:PHP alternatives by bill_mcgonigle · · Score: 1

      The one big redeeming feature of PHP is you set up a single DB server (or even multimaster) plus multiple webservers, and bam! You're sharing objects/sessions among the webservers.

      Can you link the popular solution here? Is it serializing sessions on every transaction?

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    5. Re:PHP alternatives by Anonymous Coward · · Score: 0

      You can store java session data in a DB as well. Tomcat provides this option.

    6. Re:PHP alternatives by DiegoBravo · · Score: 2

      Java, Ruby, Python... Perl... none of these were invented for serving dynamic web pages. PHP did.

    7. Re:PHP alternatives by Anonymous Coward · · Score: 0

      > bam! You're sharing objects/sessions among the webservers.

      Like everything PHP, even that doesn't work quite right. There's race conditions which you can reproduce by "clicking really fast" on an ajax element.

    8. Re:PHP alternatives by tuffy · · Score: 1

      The gist of it is that you implement your own DB-based session handler to override the default one which uses temp files. O'Reilly's "PHP in a Nutshell" demonstrates a 1 page solution, but there's likely others floating around the web.

      --

      Ita erat quando hic adveni.

    9. Re:PHP alternatives by gbjbaanb · · Score: 2

      amen to this - the reason (listen up other language guys) is that it's just there, ready to go. Want to write an app, just drop a php file in a directory on your webserver and ... well, that's it.

      PHP is like the old personal computers of yesteryear, the ones that booted into a BASIC prompt.

      My experiences with Ruby and Python have been quite less than satisfactory, ruby required a hell of a lot of hassle to get going, installing passenger, making a symlink in the apache vhost directory to the ruby code files, setting up the right directives, finding various cutting-edge gems that weren't in any repository and then I couldn't really do much in the way of debugging.

      Python was the same - first I had to install the correct version for the app I was working with, then play hunt-the-eggs.

      The whole reason PHP is so popular is because it is the only real "just works" environment. If anything, all the other languages need to understand this - its not the language syntax (they all have niggles) or the performance (the other script ones are just as bad, the JIT ones suck up resources), its the ease of getting it going.

    10. Re:PHP alternatives by Alex+Zepeda · · Score: 1

      Wait. What?

      --
      The revolution will be mocked
    11. Re:PHP alternatives by bill_mcgonigle · · Score: 1

      I'm not getting how that's not language-agnostic...

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    12. Re:PHP alternatives by steveb3210 · · Score: 1

      2. Ruby: You go to war with the webserver they give you, not the one you want.

      Huh? WebBrick is really only meant for development use.. You can hook any web server up to rails easily. For apache, just gem install passenger...

    13. Re:PHP alternatives by Reality+Master+101 · · Score: 3, Insightful

      I notice that most (not you, obviously) of the PHP defenders are posting as A/C. :)

      There is no doubt that PHP has some deep flaws, but they give you an escape from a lot of the flaws. It's possible to have a reasonable codebase written in PHP if you have good experience in the language.

      The main reason I like PHP is that it's ubiquitous. I learned a long time ago that it SUCKS to work in an unpopular environment, even if it has some sort of theoretical advantage. It's hard to find information, libraries are nonexistent or buggy, programmers are hard to find or expensive, etc, etc.

      As I see it, there are only four viable language if you want to stay mainstream: Java, C++, C# and PHP. If you want to avoid Microsoft, you're down to three. If you hate Java's verbosity, slowness and pain, as I do, you're down to two. And if you want quick productivity and rapid development for entrepreneurial reasons, that eliminates C++ and also eliminates Java again, and that leaves one to rule them all: PHP.

      I don't particularly like PHP. But it does have a lot of modern language features, and it's really easy to get code written and out. And it's reliable, if you put in the work to establish a framework (E_STRICT, turn on exceptions, etc).

      I would love to see a better mainstream language emerge, but PHP just plain wins out for certain purposes. If I was working for a large organization with plenty of time and money, I'd probably pick C++ or Java. But for a small, hungry organization, it's hard to beat PHP, which was forged by necessity. And I wish I could beat it, because it does have some pretty big flaws.

      --
      Sometimes it's best to just let stupid people be stupid.
    14. Re:PHP alternatives by Anonymous Coward · · Score: 0

      Java, Ruby, Python... Perl... none of these were invented for serving dynamic web pages. PHP did.

      And it still managed to be horrifically bad at it.

    15. Re:PHP alternatives by Anonymous Coward · · Score: 0

      That's because it is language agnostic.

      The fundamental problem is that just about everything in the post further up that mentioned this point originally is wrong and is symptomatic of the same problem that stems from just about all defenders of PHP - they show they clearly have absolutely no real knowledge of the alternatives, yet feel qualified to slag them off and defend PHP regardless.

      He was wrong to suggest storing session state easily in something like a database is a PHP only feature.

      He was wrong to complain about Java's memory footprint, because like PHP, it's configurable and is certainly no less efficient than PHP in this respect.

      He was wrong to suggest that open source Java CMS' all result in a flow of exceptions, and that when exceptions occur that they're hard to understand (well, perhaps they are if you're an amateur developer?).

      He was wrong to suggest Java isn't suitable for billion dollar websites, on the contrary, it has been running many billion dollar websites hiccup free for years, which is precisely why most people don't realise they're running Java. The same cannot be said for the likes of Facebook for example, which regularly has parts of the site fail.

      He was wrong to suggest you only have a single option for running Ruby, this is false, you can use it with the likes of Apache.

      He was wrong to talk about Python in past tense, as if the whitespace thing has killed it off, on the contrary, it's gaining traction rapidly, becoming a major force in education, which is the path Java used to become the most popular language on earth.

      He was wrong to suggest PHP is good enough. It is not, not by any measure. It is simply not good enough. It's slow, it encourages unmaintainable code, it's awful to debug even with the likes of NetBeans and xdebug, it's inconsistent in it's core libraries, it's buggy, and it also encourages insecure code to boot. You have to really know what you're doing and be aware of literally hundreds of pitfalls that stem from the poorly designed language to produce anything roughly resembling a professional product with PHP, and even then it's still worse than if you'd just used something like C#, RoR, or Java in the first place, and for anything of any size, it'll have taken you longer, cost more, and will perform more poorly too.

      He's wrong to suggest the other options are all monolithic such that if there's a problem it effects every client, this is patently false, and completely to the contrary, it's quite trivial to instantiate a PHP session running on FCGI that prevents anyone else getting a response back from the server until it has timed out or been killed.

      He's wrong to suggest Mark Zuckerberg chose PHP for reasons such as time to market, rather than the fact he chose it because it's what he, like many other amateur web developers knew. Unfortunately, being an amateur web developer isn't a barrier to making it big.

      Finally, there's at last at least one he's only partially wrong on. Sure you can debug PHP with the likes of netbeans and xdebug, but you'll face things like socket exceptions which mean you have to restart the process, you'll face a severe lack of debugging features that are standard in .NET, Java etc.

      In other words it's like I said, those who defend PHP, are those who simply have no experience, or real knowledge of anything else. They think because they've got something hacked together in it, or have managed to sponge a living building bad software out of it, that it might well be the best there is.

      What they don't realise is there are people getting paid far more of them, building real systems, with real languages. What they don't understand is that it is those people, the real professionals - those who really do have a breadth and depth of experience that puts their own to shame that they are arguing against.

    16. Re:PHP alternatives by Anonymous Coward · · Score: 0

      Try Obyx http://www.obyx.org

    17. Re:PHP alternatives by dbIII · · Score: 1

      Java's great if you're writing an desktop app for geologists trying to find oil

      Actually there's a major application showing it's utter crap for that (we still use the C based version from 2003 for most things), but that's getting a bit off topic and there are things other than choice of language that have made it utter crap.

    18. Re:PHP alternatives by Anonymous Coward · · Score: 0

      If I was working for a large organization with plenty of time and money, I'd probably pick C++ or Java. But for a small, hungry organization, it's hard to beat PHP, which was forged by necessity. And I wish I could beat it, because it does have some pretty big flaws.

      You're taking the stance of the small business owner here, saying it's the best practical choice for rapid development in spite of pretty big flaws. I haven't used the language, so I won't take a position, in fact, I'll assume you're right.

      Next question is, are you that business owner? If so, bravo. If not, by your own statements it seems you're training yourself to work primarily for employers who need things quickly, don't care if it's pretty, and don't have much money. So how do you think that effects your ability to go home at the end of the day, spend some actual time designing it so it doesn't become a pile of spaghetti, and bring home a paycheck that's competitive in the field?

    19. Re:PHP alternatives by Anonymous Coward · · Score: 0

      He was wrong to suggest storing session state easily in something like a database is a PHP only feature.

      It's not a "PHP only" feature, it's a PHP built-in feature.

      When other languages say "hey, maybe we should make some of the features required for making websites part of the standard so people using our language don't have to find one of N different competing and probably obsolete packages", then they'll be as easy to use as PHP (for the purpose of making websites).

      My first web application years and years ago was written in C. It read stdin, parsed out POST variables, and printf()'d headers and the page body back out.

      I suppose I could have found a library that would make it "easier" (read: added lines and lines of cruft to initialize various things that should have been initialized by default since it's a fucking webapp, read various things that should have been read by default since it's a fucking webapp, and set various output parameters that should have been set by default since it's a fucking webapp) but I took the "hard" way. Holy shit, if I ever see another web library that insists I personally set the text/html content type ever again I'm going to start slugging people.

  17. Yawn. by Anonymous Coward · · Score: 0

    The article is completely devoid of anything original, useful, interesting or information. It's just a collection of links of previous rantings but with boring metaphors and analogies.

  18. Re:Good things about PHP by i+kan+reed · · Score: 0

    1. No it isn't
    2. Not really
    3. C is increasingly a bad structure for languages, as improvements come in

  19. Lua by Skapare · · Score: 1

    ... FTW! \o/

    --
    now we need to go OSS in diesel cars
    1. Re:Lua by shutdown+-p+now · · Score: 1

      Lua is what JS should have been all along.

    2. Re:Lua by fatphil · · Score: 1

      http://oss.digirati.com.br/mod_lua/2.0/faq.html
      """
      Why does mod_lua's web site use PHP?

      Because we must start the project from a point. The lua version is coming soon.
      """

      Page Modified: Thu Feb 3 17:08:22 2005

      I hate almost everything about PHP, I think Lua's kinda neat (but love spelling it LUA to wind up stupid fanboys), but the above doesn't say "for the win", it says "for the give up, then lose". (And yeah, there are other ways of interfacing Lua with port 80, I know, but given apache's popularity, in particular in 2005, one would reasonably be expected the primary focus to have been on mod_lua.)

      --
      Also FatPhil on SoylentNews, id 863
    3. Re:Lua by Anonymous Coward · · Score: 0

      (but love spelling it incorrectly to prove how stupid I am)

    4. Re:Lua by Skapare · · Score: 1

      Whether I would tie Lua to Apache, or Lighttpd, or nginx, or libhttp, or whatever, depends on other things. If it's a web site running other stuff, something like Apache might be the way to go. If I can run the Lua stuff on its own IP address or port, I could just run Lua the way it was designed, as an extension language for something else, like a lean HTTP daemon in C.

      --
      now we need to go OSS in diesel cars
    5. Re:Lua by Skapare · · Score: 1

      100% agreed. +1

      --
      now we need to go OSS in diesel cars
  20. Re:Good things about PHP by wonkey_monkey · · Score: 3, Insightful

    In what way does it "live in the browser"?

    --
    systemd is Roko's Basilisk.
  21. Thats it! I am leaving by Billly+Gates · · Score: 5, Funny

    Going to Perl where I can get a simple concise syntax that is always the same among different programmers and does not have any idiosyncracies and enforced consitancy everywhere.

    1. Re:Thats it! I am leaving by ParaBug · · Score: 2

      Switching to Perl would be perfect in a single developer environment. I could reuse a lot of my work. The problem is that with almost all the teams I have worked with, either as an internal or as a consultant, the only person speaking fluently Perl was me. I would appreciate to hear what others have experienced (and I'm even willing to relocate ;) ) if I'm wrong. In web agencies, newly graduated and 2-5 years experienced developers mostly do not know Perl and are not even interested in it. I had more chance with IT guys, or anyone really working with *nix systems (not 5 minute Ubuntu install clowns). Maybe Ruby On Rails would be a better alternative to get more additional team members interested?

      --
      ParaBug
    2. Re:Thats it! I am leaving by 93+Escort+Wagon · · Score: 1

      Where I work, it's exactly the opposite. Over the past decade as people have cycled through our small group - perl has always been the single common denominator.

      --
      #DeleteChrome
    3. Re:Thats it! I am leaving by Mouldy · · Score: 1

      I currently work on the many ecommerce websites for a v. large company. My job was advertised to PHP developers and the company cross-trained me because we use Perl for pretty much all our backend code. There's pretty much no PHP. So after a year of working on the framework and in the environment - I think I can say I'm confident in my Perl abilities but am very aware that I'm losing my skills as a PHP programmer.

      So while I'm thankful of the learning opportunity - I realise there's a lot more PHP jobs out there than there are Perl jobs. I'd rather be really good at PHP that really good at Perl. I'm aware that the longer time I spend at my current company, the less transferable my programming skills will be. Which isn't necessarily an issue - I could always go down the management route.

      Just for the record; I'm one of those who maintain there's nothing particularly wrong with PHP as a language, the issue is how people use it.

    4. Re:Thats it! I am leaving by codepunk · · Score: 1

      Look a developer that already knows some other language is never going to be interested in Perl.

      You cannot go from writing in a well structured language to such a nasty hack.

      I don't stop my guys from writing perl but if they write it they own it.

      --


      Got Code?
    5. Re:Thats it! I am leaving by Anonymous Coward · · Score: 0

      Perl you say? I still find sed and awk convenient and I am feeling really lonely, even in the biggest IT departments.

  22. Major Flaw in PHP versus Perl by ambidextroustech · · Score: 1

    Although this complaint is merely a cry for PHP to receive fixes in its code, I have read on the web that a major issue with PHP has to relate to hashes. According to LWN.net, a denial of service can occur when the hash functions are put into excess which will cause the system to become unresponsive and cause denial of service.

    Yes, I do agree with my peers. The largest benefit to PHP is its C-like syntax, and TIOBE.com lists C as the top language followed closely by Java, C++ and then Objective-C, which is C with Smalltalk.

    1. Re:Major Flaw in PHP versus Perl by rev0lt · · Score: 2

      It is a stateless scripted language. Everything in the execution path can cause a denial-of-service. A typical example is the piss-poor search implementations in many many PHP sites - they fetch the limit-less dataset (regardless of size) and then they page it. Throw in a couple hundred searches like that, and you'll see the database server and the webserver crawling.
      Other examples include "heavy" functions (such as regular expressions, file operations, etc), or even framework initialization - try accessing a non-existing page with a SEO-friendly url, and they will try to match it with all the router's rules.
      Or, you know, just do some plain ol' HTTP requests to dynamic-generated pages from a fast pipe, and you'll have the same effect.

  23. When multiple major versions aren't installed by tepples · · Score: 1, Informative

    That's what major version bumps are for.

    People will stick with the old major version if shared web hosting companies don't allow hosting customers to run an app for one version and an app for another version on the same hosting plan. Even outside PHP, that's one reason Python 3 isn't taking off as fast as was hoped: the operating system doesn't know which major version to execute when the user double-clicks a .py file.

    1. Re:When multiple major versions aren't installed by Richard_at_work · · Score: 1

      That's fine, if they want to stick with a fork which is buggy, insecure and unmaintained, I have no issues with that - just as maintaining an older PHP4 project became the bane of my life (having to switch from distro packages to my own build just so I could stay on a very old version of PHP), it's the pain which forces you to do something about it.

      Coincidentally, my own experience supports my comment - there have been major breaking changes in PHP versions, and PHP has still moved on in adoption rates, so I don't think this would be an issue.

    2. Re:When multiple major versions aren't installed by Anonymous Coward · · Score: 0

      #!/usr/bin/python
      #!/usr/bin/python3
       

    3. Re:When multiple major versions aren't installed by ckaminski · · Score: 1

      That's why most hosting companies running Apache have rules that let you either specify something like .php4 or .php5 (mime type, IIRC), or have the #!/bin/python3 syntax. :-) This is a solved problem on Unix, which is what MOST hosting of PHP is.

    4. Re:When multiple major versions aren't installed by GPLHost-Thomas · · Score: 1

      Gosh! Are you really maintaining some PHP4 stuff in 2012? What's the site(s) so we can hack it?

    5. Re:When multiple major versions aren't installed by Anonymous Coward · · Score: 0

      Well, the next version of PHP could be called QIQ (P+1, H+1, P+1), to have a difference between .php & .qiq files.

      And it's a catchy name... Oh what have I done, I should have kept my mouth (or keyboard) shut.

    6. Re:When multiple major versions aren't installed by hobarrera · · Score: 1

      My OS runs python3 by default. I still code in python2. The reason people don't use python3 is due to the lack of libraries, and the work it takes to port them and any other proyect.

      Also, the OS knows pretty well which version of python to run; the one that's linked to /usr/bin/python is the default.

  24. Lousy Developers by KalvinB · · Score: 2

    If PHP were as awful as the author claims, "Some fine, even historic work has been done in PHP" would not be possible.

    Coders without the most basic grasp of object oriented designed, initial variable initialization, white-space use, code flow, etc are the problem. Languages that try to force coders to not be retarded are not the answer. It's very easy to spot coders you should never hire if they use a language that lets them reveal their ignorance and lack of organization skills.

    It's far easier to modernize code while maintaining the same core language than it is to completely start from scratch with a new language.

    While PHP's OO functionality is pretty lousy up until 5.3 when it finally got late static binding, it is perfectly sufficient and no excuse for crappy spaghetti code.

    1. Re:Lousy Developers by MightyMartian · · Score: 2

      Millions of lines of fine, historic code were written in COBOL, but I don't exactly here anyone declaring it a wondrous language.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    2. Re:Lousy Developers by edremy · · Score: 3, Insightful
      It was a wonderous language. It was (for the time) very easy to use, powerful and understandable. Millions of lines of code were written in it because it *worked*.

      Fortran's pretty similar- nobody here is going to hold it up as a language marvel, but it was- it fit the niche of "powerful number processor" very well. Perl is noted for being a complete mess, but if you need a quick script to massage some text nothing is better. BASIC fit into its niche as well, and frankly so does PHP

      None of them were "elegant" in the sense of LISP, Smalltalk or Haskell. How are those doing by the way?

      --
      "Seven Deadly Sins? I thought it was a to-do list!"
    3. Re:Lousy Developers by mridoni · · Score: 1

      Yes, COBOL, when compared with any modern language, sucks, because it just sports a dozen features instead of 1200. The thing is: those features are rock-solid. and this is why COBOL is still in use and programs written in the 70s still run flawlessly

    4. Re:Lousy Developers by narcc · · Score: 1

      Indeed. It's fast and reliable.

      There are innumerable stories relating failed COBOL-on-a-mainframe to Java-on-commodity-hardware "upgrade" projects for a reason.

  25. PHP: The next COBOL by Anonymous Coward · · Score: 1

    Am I the only one that's already starting to see similarities between PHP and COBOL? Both languages are designed for "non programmers". Both languages have a multitude of projects written in them.. and I suspect in 30 years, some of those web applications will still be running on "legacy" x86 hardware rather than ARM or whatever we'll all be running then and every young programmer will be complaining on their blogs or whatever about how bad of a language PHP is and why anyone ever made any project in it.

  26. Hear Hear by Anonymous Coward · · Score: 0

    Dead on. As an old PHP user I'd go further and say PHP's story is a cautionary tail for all those "alternatives". PHP is open source but really controlled by Zend. To wrench that control away from them would not be worth the effort.

    Ruby and Rails (what I use currently) are just this side of out of control. Assembling a stack that works (an often unique collection of Gems, Ruby, and Rails versions) is touchy and when you get one that works you don't want to futz with it much. So the community has created ways to lock down everything and swap out whole dev environments when you work on different projects.

    This is a little understood problem with OSS. Either the contoling party is asleep at the wheel or it is community controlled and tetering on the verge of chaos. Always look at control and community before picking an alternative.

  27. Source of PHP programmers by EmperorOfCanada · · Score: 5, Insightful

    I would be less quick to blame PHP than blame the fact that many PHP programmers come from "Web" developers. People who started with MS Paint and some HTML, then some CSS and then jammed in some PHP. After a while they got pretty good at small PHP 50 line programs. But when faced with huge projects people like this just aren't prepared. A great programmer could use PHP just as well as any other language.

    But the second half is that PHP should be bad at times. Often a simple unstructured script is the best. It needs to do a simple thing quickly and well. There is no need for templating, language abstraction, unit testing, separation of data, logic, and view. So if you are a bank deploying a mission critical system then it should be rigorous and perfect. But if your blog about car tires needs a widget that reads from your odometer then hack away.

    I would say that all arguments that condemn PHP should whither under the light that Facebook was developed primarily in PHP with MySQL. Even now they have their Hip Hop that converts PHP to C++. Arguing against PHP is like saying that Carbon Fiber is a better material than steel for car frames. Absolutely true but most cars are still successfully made from steel for a wide variety of reasons. Next time I need to win an F1 challenge and it had better be Carbon Fiber. But for the next ride to the grocery store and I just don't care.
    So to circle around one could argue that the best cars are made from this or that but the reality is that what made the truly terrible cars terrible was that the designer would have made a terrible car out of anything. So teach a "better" language to the people making messes with PHP and you will just have a different kind of mess.

    1. Re:Source of PHP programmers by Tough+Love · · Score: 1

      Even now they have their Hip Hop that converts PHP to C++. Arguing against PHP is like saying that Carbon Fiber is a better material than steel for car frames.

      May I please improve your car analogy? Good to hear Facebook now makes its airplanes out of aluminum instead of wood.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    2. Re:Source of PHP programmers by Grishnakh · · Score: 1

      Most cars are made from steel because it's cheap, easy to work with (welding), and its properties are extremely well-understood. Some cars are starting to be made with partial or all-aluminum chasses, because it weighs less and isn't that much more expensive and they've developed better joining techniques in recent years (for a long time, it was hard to weld it), so its cost is justified for, say, a $50+k Audi or Lotus. Very, very few cars are made with carbon fiber, and it's all about cost and manufacturability: the cost is not cheap for the materials, but even worse is the labor, because CF has to be made by hand, there's no such thing as automated manufacturing of carbon fiber products. So it makes sense for a $1.2 million Ferrari Enzo, but that's about it. Even then, such cars usually don't have only CF for their chasses, they employ various different materials in a composite; I believe a lightweight aluminum honeycomb core material is frequently used.

      This actually parallels with PHP from what I can tell. PHP is like steel: it's super cheap (you can get $4/month hosting plans with PHP all over the place; good luck finding a Java host for that), it's easy to work with for non-experts and get something working decently, and the alternatives all have serious drawbacks. Java is something like carbon fiber: it's expensive as hell (you'd probably need a dedicated host for it, and the monthly costs are probably quite high for something like that) and doing simple things in it isn't that simple. Like you said about the car tire blog, making a little widget to show an odometer or something to visitors will be fast in PHP, not so much in Java unless you're a Java expert already. The others aren't much better; I don't see a lot of web hosting plans with Ruby or Python.

      With PHP, all I have to do is drop in a .php file, put some <?php tags in my HTML, and it works. Can I do that with Python or Ruby?

    3. Re:Source of PHP programmers by tbird81 · · Score: 1

      An airplane's not a car. I don't understand any of this!

    4. Re:Source of PHP programmers by Tough+Love · · Score: 1

      If you want to fly, an airplane is an improvement on a car. I hope that clarifies things.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    5. Re:Source of PHP programmers by narcc · · Score: 1

      Nonsense! I've been waiting for a damn flying car for years.

      Probably because heavier-than-air flight is just impossible.

    6. Re:Source of PHP programmers by Anonymous Coward · · Score: 0

      I would say that all arguments that condemn PHP should whither under the light that Facebook was developed primarily in PHP with MySQL.

      Actually, any argument involving Facebook automatically condemns anything associated with it. (And MySQL is even shittier than PHP.)

  28. Missing the forest for the trees by Angst+Badger · · Score: 5, Insightful

    I've programmed in every major language and several minor ones from the 1970's to the present day, never mind design methodologies. They all have their relative strengths and weaknesses, but at the end of the day, the only thing that really recommends one over the other is a) what's available, and b) what you're most familiar with. No widely used language is "broken" any more than any natural spoken language is broken. No one ever says, hey, this novel would be much easier to write if we were taking advantage of the greater expressive power of Indonesian instead of kludgy old Lithuanian.

    Aside from juvenile cliquishness and fashion obsession, every language flamefest starts with people obsessing on some awkward feature of the dominant language du jour, and then concluding that all of their problems would be solved if we all switched to some other language without that awkward feature. Of course, tomorrow's language (or methodology, editor, coding standard, platform) has its own awkward qualities that will only become apparent once it collides with the real world on a large scale, setting the stage for the day after tomorrow's language. Rarely does anyone pull their head out of their compiler/interpreter long enough to recognize that it's the real world that's awkward, and no amount of switching between fundamentally equivalent machine-parseable languages is going to change that.

    Instead, we keep implementing the same stuff over and over in one language after another until the pace of real progress slows so much that we can actually get excited that the document viewer we're trying to port everything over to is receiving a "major" new features in HTML5 that will allow it to get a little closer to matching the desktop GUI functionality of twenty years ago, only not as well and with the added requirement of several orders of magnitude more hardware power required to keep it going.

    But by all means, let's get rid of PHP if that makes it easier to imagine that we're doing something besides reinventing the same old wheel and doing it badly.

    --
    Proud member of the Weirdo-American community.
    1. Re:Missing the forest for the trees by gbjbaanb · · Score: 3, Interesting

      so PHP is like English with its mess of irregular verbs and pronouns. I guess the 'best' language is Smalltalk... the Latin of the computing world.

    2. Re:Missing the forest for the trees by Anonymous Coward · · Score: 2, Informative

      Programming tastes evolve over time. At one point, and for at least a few years, I believed Python was the one true language revealed mystically to GVR. Up until that point, I'd done most programming in C++, so you can imagine how much fun Python was, in comparison. After further development and discovery of other programming languages, the shortcomings of Python have become obnoxious, much like torturing someone by dripping water on their forehead incessantly. Part of the problem is that I have to use Python for my professional work now. Using a language for your day job is a sure way to reveal all the issues.

      Here's what rubs me raw day-in and day-out:

      1. Lack of immutable/persistent data structures. 2. Lack of multi-line anonymous functions/lambda. 3. Variable scoping fail, causing hacks like the new `nonlocal` keyword. 4. worst_possible_variable_name_convention. 5. Python evangelism. (community issue, mostly) 6. Hypocritical "explicit is better" and "flat over nested" values with insane amounts of magic built into language and class system. 7. No switch. 8. GIL. (Actually the CPython runtime in general) 9. No macros. 10. the insane way "unicode" is supported. 11. and on and on...

      At this point I write Python code, but not generally by choice. Mostly my coworkers can't even imagine writing code in another language, given that we have been allowed to choose our implementation language(s) as a team.

    3. Re:Missing the forest for the trees by shutdown+-p+now · · Score: 2

      The problem with PHP is that it's not "one awkward feature", it's literally half the language. All other mainstream languages have their awkward sides, but they either have significantly less (like, say, Python), or they have something to compensate for it (like, say, C++).

      In "PHP: A Fractal of Bad Design", the author compares using PHP with using a rock to drive nails in, and that comparison is very accurate. We can argue about the precise shape of the hammer, and how minor changes in the grip may have profound effects on productivity. But no-one can seriously defend a rock as a viable way of handling nails. If it's literally the only thing you've got, then sure, but that's not the case anymore, and hasn't been for years.

    4. Re:Missing the forest for the trees by hazah · · Score: 1

      Probably the best comment on the subject thus far. I'm about a 1/4 of the way on your path, but the comparison to real languages had been ringing true for quite some time now. Expressive power of a language is great... if one has something to express to begin with.

    5. Re:Missing the forest for the trees by Anonymous Coward · · Score: 0

      Actually the process you talked about has essentially happened within the PHP world.

      99% of the oldschool PHP code (register_globals, mysql_escape, addslashes, etc) has long been tossed out. Most of that code was spaghetti, totally insecure, and married to table-based layouts.

      Modern "OO PHP" code is based on MVC frameworks, ORMs, and so on, and has a completely different vernacular than the stuff from 10 years ago. The other half of the PHP world is so married to CMS systems like WordPress and Drupal that they're largely coding against those abstractions. If some PHP developer timewarped in from 2002 and started coding database queries in an empty *.php file, he would be promptly expelled from both camps.

    6. Re:Missing the forest for the trees by Anonymous Coward · · Score: 0

      every language flamefest starts with people obsessing on some awkward feature of the dominant language du jour, and then concluding that all of their problems would be solved if we all switched to some other language without that awkward feature.

      The problem with your conclusion is that there really are some crucially important differences between languages. There aren't many -- but they do exist.

      One prime example is having a convenient mechanism for developers to ensure type safety. If a language (such as JavaScript) is missing that feature, then I have found that it costs me significantly more development time in the long run.

      I worked with C++ extensively for 12+ years. I have also worked with JavaScript extensively for 8+ years, and 100% of my coding for the past 2 years has been in JavaScript. JavaScript's lack of option for type checking is an on-going, enduring obstacle for me that will never go away. It is -- quite simply -- a fundamental failure of the language. (PHP used to have that failure too, but then they fixed it somewhat.) I would have never guessed this when I started with JavaScript. I came to this conclusion gradually, by noting the number of hours every week that I spend in the debugger figuring out that the problem is due to some typo or some misreading of the API that a better language would have figured out automatically for me. My viewpoint is strongly colored by my years of experience in C++. I remember how much the C++ compiler helped me, and so I am keenly aware of what I am missing now with JavaScript, and how big of an issue this is for large coding projects.

    7. Re:Missing the forest for the trees by Terrasque · · Score: 1

      I agree with number 2, that have annoyed me a few times, too... For the rest, I haven't really been in a situation for that to be a problem.

      7. Well, you got the dict solution / hack. Not exactly the same, but does well enough for most situations, and can be a lot more flexible.

      8. This is mostly a CPython problem (as you noted), and in many cases the multiprocessing module can be a very nice workaround.

      10. Kinda agree with you on this, need to keep a clear head on working with that. Python 3 have apparantly done some changes on those things, hopefully for the better (I haven't looked much at python3 yet)

      While python is not perfect, it is the best language I know well, followed by *gasp* JavaScript (which is a really neat little language if you take the time to learn it), and a bit of C# or Java for some tasks (I like C# better than java, but sometimes it's Java or nothing.. And those languages are pretty similar for the most part).

      When that's said.. Just about every language I've worked with have some cool qualities and nifty stuff, except for PHP. That language is just an unholy mess. I can still code in it, but I really prefer not to.

      --
      It's The Golden Rule: "He who has the gold makes the rules."
    8. Re:Missing the forest for the trees by Anonymous Coward · · Score: 0

      Instead, we keep implementing the same stuff over and over in one language after another until the pace of real progress slows so much that we can actually get excited that the document viewer we're trying to port everything over to is receiving a "major" new features in HTML5 that will allow it to get a little closer to matching the desktop GUI functionality of twenty years ago, only not as well and with the added requirement of several orders of magnitude more hardware power required to keep it going.

      Amen brother.

    9. Re:Missing the forest for the trees by narcc · · Score: 1

      The problem with that article is that the author doesn't offer anything to readers who aren't already in complete agreement with him. A summary might read: "It's hard to explain why I think PHP is shit, but it is. It's like a box of tools that are okay, but not quite what you want." An analogy is fine, but it needs specific examples that support the analogy. Otherwise all he's saying is "I think PHP is bad because it's not very good" -- not the most convincing argument

      Well, that's not fair. He does *try* to give a few examples, though the majority are "I don't like this or that syntax" or "I think it should be different" though he does seem to miss the "why", iirc, every single time.

      He trys in the operator section about the behavior of == , however his example "1e3" == "1000" makes perfect sense and is exactly what you'd expect if both strings were converted to some number type before comparison. (iirc, C's atol would convert "1e3" to 1000) My advice to him on that point would be to read the documentation to learn how typing works -- it's not C, and you need to be especially careful with types in "typeless" languages like PHP. I guess "it's typeless" could be a valid complaint, but is more likely to start a holy war than a productive discussion about the merits of the language!

      Indeed, the majority of his complaints just don't make sense. Take "Appending to an array is done with $foo[] = $bar", for example. What's wrong with that? Is it somehow worse than "$foo[count($foo)] = $bar;" or "array_push($foo, $bar);"?

      I'd find a better article criticizing PHP. This one just isn't very good. Well, it's too big to criticize in its entirety, so it's got that going for it. (That is, you could easily defend it by saying "you didn't address X")

    10. Re:Missing the forest for the trees by shutdown+-p+now · · Score: 1

      He trys in the operator section about the behavior of == , however his example "1e3" == "1000" makes perfect sense and is exactly what you'd expect if both strings were converted to some number type before comparison.

      Why the hell would you expect the strings to be converted to some number though, when both operands are strings? Literally no other language does it. Except Perl, but at least it's got an excuse in form of dedicated string comparison operators like "eq", so it's kinda like + vs concat - if you use numeric comparison it always converts to numbers, if you use string comparison it always compares to string. But in PHP, in practice, == is so convoluted that it's effectively something that you shouldn't ever use, because the chances of it having semantics that you didn't intend in corner cases is too high. So why it's there?

      Note that this has nothing to do with language being "typeless", which PHP isn't anyway (it's dynamically typed). No other language pulls the same kind of crap, statically or dynamically typed. Even JS doesn't convert strings to doubles when == is applied to them.

    11. Re:Missing the forest for the trees by narcc · · Score: 2

      Why the hell would you expect the strings to be converted to some number though, when both operands are strings?

      Because that's the documented behavior

      If you compare a number with a string or the comparison involves numerical strings, then each string is converted to a number and the comparison performed numerically. These rules also apply to the switch statement. The type conversion does not take place when the comparison is === or !== as this involves comparing the type as well as the value.

      Sorry, I don't understand what the problem is here? It's like complaining that the ^ operator in C is used for XOR when it's used for exponents in other languages or that = does assignment instead of a comparison in one language when it does both in other languages depending on context.

      If you don't want a straight string comparison instead, you need to use a different operator (===). The complaint is equivalent to "I don't like this operator, I want to use the other one!" with the justification being "I don't understand how it comes up with 1000 from that crazy 1e3"

      That's why I don't think the article is very good. it's not well thought out, virtually none of his complaints are supported/justified and when they are (he tries to justify his complaint), they don't show any real problem with the language other than "I don't like it" and sometimes "I don't understand it". Using the same standard he does, you could write a rant of similar-length about nearly every programming language.

      To someone who isn't convinced, it's just not convincing. I would really recommend you find a better article that criticizes PHP. I can try to find one for you if you'd like.

    12. Re:Missing the forest for the trees by shutdown+-p+now · · Score: 1

      If pressing a button that says 'Coffee' pours you tea instead, "it's documented" is not a valid excuse. PHP pretends to be a C-style language, with curly braces and whatnot - indeed, it's often cited as one of its advantages. Once that context is established, one would expect operator == to behave in a certain way - or at least to not behave in a certain way. Java, C#, JavaScript and a dozen other languages with similar syntax manage it just fine. PHP does not.

      One of the basic principles of solid PL design is the principle of least surprise. A language that routinely violates it for no reason whatsoever is a poorly designed language, period. In case of PHP, there isn't even an excuse (as e.g. Perl has) - we know how it evolved, and we know that its design is essentially an aggregation of random decisions along the lines of "let's do it like in C", and then next day "let's do it like in Perl", and then next day "let's do it like I dunno lol". Of course it sucks! It couldn't possibly be any other way - it'd be like expecting a monkey banging on a typewriter to produce a haiku.

    13. Re:Missing the forest for the trees by narcc · · Score: 1

      Damnit, I skipped the rest:

      But in PHP, in practice, == is so convoluted that it's effectively something that you shouldn't ever use, because the chances of it having semantics that you didn't intend in corner cases is too high. So why it's there?

      It's there because you'll only have problems in extremely rare/unusual cases. In day-to-day use (e.g. web-based CRUD app) it works just fine. User inputs a number in a field, your script gets it as a string, and you later use that in a comparison treating it like a number (because that's what it's supposed to be). It works fine in that case, and does exactly what is says on the tin. It can really only cause a problem if you don't know what the operator is doing. (This is true of any operator: lot's of problems caused by ^ in other languages because the developer thought it did something completely different that what it actually does.)

      To be honest, I've never once seen it cause a problem. Sure, it seems weird if your used to static typing, but the behavior is very well documented and not exactly difficult to follow. If you don't like it, or that behavior is likely to cause you problems, just use a different operator. (I don't use * when I want to subtract because * does not work that way.) Otherwise, == is rather convenient and, above all, actually makes sense to use most of the time in the context that PHP is most often used.

      Really, it's not that different that the "weird" behavior you seemingly get in languages where + is used for string concatenation and addition. Obviously, if you know the basics of the language you're working in, neither == nor the double-duty + will cause you any more problems than the ^ operator. (Though you could make an argument that + pulling double duty is bad language design as the typical work-around is rather hackish.)

      Note that this has nothing to do with language being "typeless", which PHP isn't anyway

      Yes, that's why I put the word "typeless" it in quotes: so you and everyone else would know what I mean without either one of us needing to be pedantic, eventually ending up in a stupid argument about what to call PHPs type system. Well, I thought we could avoid that. That'll teach me. I'll never try to be clear without being needlessly precise again.

    14. Re:Missing the forest for the trees by narcc · · Score: 1

      If pressing a button that says 'Coffee' pours you tea instead, "it's documented" is not a valid excuse.

      What? == compares two values for equality. It's not like it multiplies them together and returns the square root!

      PHP pretends to be a C-style language, with curly braces and whatnot - indeed, it's often cited as one of its advantages. Once that context is established, one would expect operator == to behave in a certain way - or at least to not behave in a certain way. Java, C#, JavaScript and a dozen other languages with similar syntax manage it just fine. PHP does not.

      Ah, that's where you're wrong. == behaves similarly in other languages as well. JavaScript uses C-style syntax and 10=="10" -- oh, and "1e3"==1000 there as well. JS doesn't do the conversion if both the l and r operand are strings, sure, but you're less likely to encounter that case than you are in the typical PHP use case where you are much more likely to want to compare two strings as if they were numbers.

      In the case of PHP that is, and should be, the expected behavior. Thinking about it now, I suspect that the author purposefully chose examples like "1e3"=="1000" because to the naive reader it looks like the operator is doing something completely incomprehensible, when in reality it's doing exactly what any sane person would expect it to do. That's just plain dishonest and further erodes the author's credibility -- making a terrible article even worse.

      One of the basic principles of solid PL design is the principle of least surprise.

      Sure. And PHP's == operator does not in any way violate that!

        Why are we arguing over this tiny point? My point was that the article wasn't very good and that you'd do well to find a better article.

      A language that routinely violates it for no reason whatsoever is a poorly designed language, period.

      Okay, but the == operator in PHP rather obviously doesn't qualify. It behaves exactly as expected in the most common use cases. If it didn't do the conversion, the behavior of that operator would astonish new users more! (i.e the behavior of == would be more, not less, astonishing.)

      Though I'll note that you'd be hard-pressed to find a language with nothing that violates that principle for no reason whatsoever, the holy C included.

      Again, I'm not defending PHP -- this is not a discussion about how good or poor the language is. This is about the article and how shitty it is. I recommended that you find a better article as this one is unconvincing and poorly written. I even offered to help you find a better article.

    15. Re:Missing the forest for the trees by fatphil · · Score: 1

      >> Why the hell would you expect the strings to be converted to some number though, when both operands are strings?

      > Because that's the documented behavior

      You have misinterpreted the question.

      The question was not:
      "Why *in a program*, would you expect ..."
      Which you answered by saying "because the language defines it that way". Factually correct, but not in any way useful.

      The question was:
      "Why, *in a language*, would you expect ..."
      which your answer doesn't even begin to address.

      --
      Also FatPhil on SoylentNews, id 863
    16. Re:Missing the forest for the trees by dmgxmichael · · Score: 1

      Vos scilicet non loqui latin.

    17. Re:Missing the forest for the trees by Anonymous Coward · · Score: 0

      You have never studied latin, obviously. Otherwise you would know that its grammar was complex and full of exceptions and irregularities.

    18. Re:Missing the forest for the trees by Anonymous Coward · · Score: 0

      It's there because you'll only have problems in extremely rare/unusual cases.

      That's worse, because it increases the chances that the problems won't be noticed until the code's in production.

  29. Re:Fix? I think you mean, "migrate" by ewieling · · Score: 5, Insightful

    The C-like syntax and wrappers for all sorts of handy stuff like POSIX threading, sockets, SSL, etc is why I like PHP. My biggest issue with PHP is that these functions are poorly documented (especially the SSL wrappers). I am not a language purist, I want something easy to use, gives me access to all the nifty stuff Unix can provide, and doesn't make me learn an entirely new syntax. If I was a professional programmer I might feel differently, but for MY needs at my job and for personal projects PHP is a good tool.

    --
    I really shouldn't have used someone else's email address for this account.
  30. Languages don't make bad code, programmers do by melonman · · Score: 5, Insightful

    The assumption in TFA seems to be that PHP does something that couldn't be done otherwise now, or does it more easily, or something. But I don't think that's true. There are alternative languages and alternative ecosystems now. IMO, most PHP coders don't use PHP because they have looked at the alternatives and decided PHP is the best choice, or the least bad choice, or any other choice. People use PHP because either

    1: It was forced upon them for some reason or

    2: It was the first thing they found and it was good enough

    If that's the case, it's irrelevant how fantastic the alternatives are.

    Also, while PHP code can be truly terrible, people who are determined to write terrible code will do so whatever the tool. You can use almost anything as a hammer if you try hard enough. The myth that The One Right Language somehow makes bad programmers good is still alive, especially within the Python community, but it's stll a myth.

    When good programmers have no choice but to use PHP, they'll find a way to build something that is workmanlike even if it isn't beautiful. When bad programmers program, the result is going to be bad regardless of the language.

    --
    Virtually serving coffee
    1. Re:Languages don't make bad code, programmers do by Anonymous Coward · · Score: 1

      Languages *do* matter - there's a reason there are very few (if any?) websites written in pure C. There are a certain set of problems that have to be addressed for any programming project, and using a language (and environment - libraries, etc.) where you can concisely and clearly express robust solutions to those problems is a huge advantage. It's easy to write bad code in any language, but there are (problem,language) pairs which make it virtually impossible to write good code.

    2. Re:Languages don't make bad code, programmers do by shutdown+-p+now · · Score: 1

      I'll just quote the article in my sig:

      Do not tell me that “good developers can write good code in any language”, or bad developers blah blah. That doesn’t mean anything. A good carpenter can drive in a nail with either a rock or a hammer, but how many carpenters do you see bashing stuff with rocks? Part of what makes a good developer is the ability to choose the tools that work best.

    3. Re:Languages don't make bad code, programmers do by wmbetts · · Score: 1

      I've been programming in PHP for over a decade now. Back when I started I was a C programmer and PHP fit what I needed "better" than C did. I absolutely hated writing a web page with C/CGI. My original code looked a lot like C and the learning curve was almost non-existent. As time went on other languages popped up and matured into proper web languages. By this time I had so much code and time invested into PHP I didn't feel like learning python or ruby. I'm pretty sure I'm not the only person who felt like that. For all it's faults it's made me a lot of money and provided a nice income for many years. I have C for *NIX development, C# for Windows development, PHP for web stuff, and perl for other random things. Having said that I'm in the process of learning Python now that I have more time and it's quite a fun language. I wish I would have done this earlier.

      --
      "Ubuntu" -- an African word, meaning "Slackware is too hard for me". - stolen from Dan C alt.os.linux.slackware
    4. Re:Languages don't make bad code, programmers do by Anonymous Coward · · Score: 0

      Bad programmers also make bad languages. PHP feels like shit thrown together and unfortunately it stuck. These quotes by the creator of PHP pretty much sum up what I think of the language (https://en.wikiquote.org/wiki/Rasmus_Lerdorf):

      "I'm not a real programmer. I throw together things until it works then I move on. The real programmers will say "Yeah it works but you're leaking memory everywhere. Perhaps we should fix that." I’ll just restart Apache every 10 requests."

      "I don't know how to stop it, there was never any intent to write a programming language [...] I have absolutely no idea how to write a programming language, I just kept adding the next logical step on the way."

    5. Re:Languages don't make bad code, programmers do by Anonymous Coward · · Score: 0

      People use PHP because they don't want to program. They just want to write HTML interspersed with code, certainly at the beginning of the project but also when they need to crank out ad hoc pages at the last minute. ColdFusion is the only other language that does that well, but it was proprietary back-in-the-day and so PHP won the mindshare, especially since it had all that glue for third-party C libraries.

      Yes, all the other languages have their super fancy templating systems and frameworks. Well, I don't want your super-duper framework with 12 pages of FAQs explaining how it's better than every other system. I just want to write HTML interspersed with some code, without having to install libraries or frameworks.

      Personally, I dislike PHP immensely and just write static HTML pages generated using XSLT. But there's really nothing else like it. Some day I want to write a PHP or ColdFusion engine which compiles to Lua byte code. Although the key to PHP's success is more than syntax and inline HTML, so that's not really going to unseat PHP.

  31. The problem is somewhere behind that cloud by gmuslera · · Score: 1

    ... or maybe is all the cloud the problem. Maybe isnt just the language itself the problem, also the culture behind it, people that did it, that contributed to it, tools all around that helped or damaged it, and, of course, the ones that try to use it as a normal hammer instead of the double-clawed hammer that it is. Changing the language alone won't change the other factors, and a in a used enough language you don't take a photo, you get a whole process where all the factors take part, a full ecoystem is behind. i.e. take another language, like python o ruby, and try to put the same ecosystem behind it, fullfill the same requirements, with the same people, probably would get to the same place.

    What are the alternatives? A closed/comitee ecosystem? Strong approval policies to accept contributions? Maybe some of the good things of PHP came because is not that way.

    You can always take your prefered language, and build around it most of the tools/libraries/etc that made php popular, with as much points of common as possible, but with the bad parts (for some definition of bad) out. But there is more than just code what will make it succeed or not.

  32. It's always been obvious by Anonymous Coward · · Score: 4, Insightful

    Python has *always* been obviously better than PHP (or perl, etc.) But if you have no skills, you look for the easiest path: the goal is to get the project going.

    If your expertise is Perl, climbing the Python learning curve, gentle as it may be, isn't attractive, and becomes less so as your available time to engage in such things narrows. And so your project $sucks @terribly $$ and looks like APL But it works fine because you know how all that perl weirdness operates:


            $_ = shift;
            tr/+/ /;
            s/%(..)/pack('c', hex($1))/eg;
            return($_);

    For a new user with no skills (which really seems to be the primary group that ends up using it), the availability of PHP examples and the ease of putting a canned site up seem to be the primary enticements. Slap a canned site up, and bam, there you are. *Now* you can learn how it works (which accounts of a lot of strange things on the web, but I digress.)

    So better isn't really the issue. Easier is the bottom line, it seems to me. Where are the canned sites in Python? For that matter where are the canned sites in Perl or Ruby or whatever?

    If "better" were all it took, no one would be running Windows, for instance, but that's not the case.

    Mind you... *I'm* not running windows, and I long ago abandoned Perl for Python (and I'm so glad I did), but I'm someone who actually has the time to explore and make choices without someone else hovering over my shoulder or otherwise being compromised. I don't think that's very common.

    1. Re:It's always been obvious by Anonymous Coward · · Score: 0

      Perl is a gibberish language. Just like APL, as the GP indicates. It can work fine, sure. So can any number of other languages. BASIC, even. But better? Perl isn't the type of language that can aspire to being "better." As a language, it's alphabet soup and random appurtenances, no more than that. Python was inherently better when it was no more than an idea -- because it was never gibberish, never random, never grew by accretion, only by thoughtful design -- Learning/teaching Perl today as a starter? That's just abuse. The Python 2-series is the way to go (Python 3 is a different language... and a failed one, at that.)

    2. Re:It's always been obvious by Zamphatta · · Score: 5, Insightful

      Is this modded -1 & "offtopic" because the 1st word is "Python"?!? C'mon mods, at least read the first sentence before spending your mod points. This guy spells out exactly why I got into PHP. It was 1999, and I was struggling for months to write some good PERL scripts. Once I switched to a webhost with PHP, I made things work in less than a month. That's what's RIGHT about PHP for websites. That's why nobody really fixes it even though everybody complains "it's broken".... which is a ridiculous concept, since it gets things done quickly when you have little skills. So PHP should really be talked called "the gateway drug" to more hardcore coding, 'cause that's what it is for most people. If you expect it to be as awesome as Python, C, PERL, Ruby, etc, then you're totally misunderstanding PHP and yes -- you'll see it as broken.

    3. Re:It's always been obvious by Anonymous Coward · · Score: 0

      That was from a title with no google.

      Started in 2005 with turbogears/python, never looked back at php. Now if more people were better at using search site back then...

    4. Re:It's always been obvious by Anonymous Coward · · Score: 0

      Okay -- I didn't deny any of that. But what part of that justifies claiming Python has always been obviously better than Perl? How in the world can you say a non-existent language (as Python was for the first few years of Perl's existence) is better than a real one?

      Fanboyism -- replacing reasonable statements of actual superiority with ludicrous hyperbole since... well, before I was born, anyway.

    5. Re:It's always been obvious by Anonymous Coward · · Score: 0

      So, um, why are you manually decoding query parametres in URLs in Perl? Have you not heard of CGI.pm or any of the dozen frameworks that do the thing for you?

      Yes, I know it's fun to quote a regexp and the $_ convenience variable when trying to highlight Perl's potential illegibility, but let's see that code segment in Ruby:

      def decode_query_string (query)
        query.tr!('+', ' ')
        query.gsub!(/%(..)/) { |s| [ $1.to_i(16) ].pack("c") }
        return query
      end

      Much clearer, no? How is that written in Python?

      May I recommend you read Modern Perl, the (free) book, that succinctly describes the language?

    6. Re:It's always been obvious by fredrik70 · · Score: 3, Insightful

      indeed , PHP can very much be 'good enough'. Nowadays I prefer other languages, but i struggle to understand the hate towards php. Yeah, it might have some warts, but it has a standard lib that does pretty much al you can ask for and it runs on pretty much all webhosters.

      --
      if (!signature) { throw std::runtime_error("No sig!"); }
    7. Re:It's always been obvious by bandy · · Score: 4, Funny

      Python has *always* been obviously better than PHP (or perl, etc.) But if you have no skills, you look for the easiest path: the goal is to get the project going.

      If your expertise is Perl, climbing the Python learning curve, gentle as it may be, isn't attractive, and becomes less so as your available time to engage in such things narrows. And so your project $sucks @terribly $$ and looks like APL

      This is how I can tell that you're not an APL programmer. APL programs are beautiful. Perl looks as if your mom picked up the phone while you were using a BBS.

      --
      "You might as well get your son a ticket to hell as give him a five string banjo." -unknown minister
    8. Re:It's always been obvious by kryptKnight · · Score: 2

      It's modded off topic because it replied to the FP for visibility even though the parent has fuck all to do with Python or anything even related to the off topic post you're championing.

      --
      Facts do not cease to exist because they are ignored. -Aldous Huxley
    9. Re:It's always been obvious by Anonymous Coward · · Score: 0

      The only people who have a problem with php are .net spaghetti code developers that fail to understand the basic concepts behind it, or any language like it. The only reason you don't see these morons railing against c++ is because the value of c++ can't be denied. Php on the other hand... they have a language that kinda does that.... right?

    10. Re:It's always been obvious by Zamphatta · · Score: 1

      That makes sense. I didn't notice how it related or didn't relate to the direct parent. I'll have to keep an eye out for that in the future, thanks. I just noticed that it was directly related to the article & made some good points, so I didn't think of it as offtopic.

    11. Re:It's always been obvious by multicoregeneral · · Score: 1

      Look, a good programmer can build a well built program in any language he chooses, be it c, php, javascript, whatever. Good programmers are artists who spend years, even decades developing their craft. And it's a poor artist that blames his brushes and paint for not being able to meet the expectations of his canvas. I honestly cringe when I think about the kind of code that these people who constantly criticize php must be writing.

      --
      This signature intentionally left blank.
    12. Re:It's always been obvious by Schmorgluck · · Score: 1

      $_ = shift;
      tr/+/ /;
      s/%(..)/pack('c', hex($1))/eg;
      return($_);

      I'm self-taught in Perl, and it took me only a few seconds to understand what this code does. Granted, it would have taken me longer when I was beginning, but still, I don't see anything wrong with this code. It's quite straightforward, actually. Seriously, there are sloppy programmers in any language, but you seem to suck at showing an exemple of sloppy code. If that was your intention, that is.

      Note that I have nothing against Python, I'm starting to learn it out of curiosity.

      But I agree about your point about PHP being an easiest path up to a certain point. If I may risk a Perl comparison, it's a lot like coding in Perl without "use strict": it works for very simple things, but past a (rather low) level of complexity, it quickly becomes a mess.

      Every time I tried to learn PHP, I ended up with a headache as soon as I tried to do anything more complex than taking some shit out of a DB and inserting it in the HTML page.

      There's one thing PHP has got for it, still, that may also have given it a boost at first, it's the fact that you could put the code in treatment instructions markers in an (X)HTML page, which made the document well-formed XML. No such stupid shit as the <%..%> marker in JSP, for example.

      But the main selling point was that it was (at least apparently) easy to deploy for unskilled server admins. It wasn't designed to write files in a file system, therefore it wasn't a risk to said file system.

      It allowed for PLENTY of amateur free or very cheap servers, handled by operators of various skill levels, which was GREAT for the pennyless who just wanted to set up their personal website. As a result, plenty of people ended up having half-assed skills in Web building, and PHP skills were a cheap commodity.

      --
      There's nothing like $HOME
    13. Re:It's always been obvious by mcrbids · · Score: 2

      For all the stuff that PHP gets wrong, it gets getting started right. It's fostering a virtual fountain of startups, written by tech-oriented people who have an idea and are looking to get the ball rolling as easily as possible. Take a look at the PHP ecosystem, you'll see this happening everywhere. It's why some of the biggest companies around (Facebook? Yahoo?) use it - it gets you going quickly, is well documented, works reliably, has a fairly simple syntax that beginners and fresh graduates can understand immediately, and is available E.V.E.R.Y .W.H.E.R.E....

      Knock it because it's not pedantic enough? It's OO is limited, it's API is randomly_underscored, needle/haystack ordering in functions is random, slow as a fat dog compared to c/java... Well, sure, that's popular, and as one of those tech-oriented people who built a million dollar company with a PHP-based product, I'd agree with you on every single point!

      But it still works, works well, and it was exactly what I needed when I started up, and, especially at first, it's more important to make your idea work than it is to be elegant.

      --
      I have no problem with your religion until you decide it's reason to deprive others of the truth.
    14. Re:It's always been obvious by Anonymous Coward · · Score: 0

      Re: Ruby
      Have you never heard of Rails?

    15. Re:It's always been obvious by kestasjk · · Score: 2

      Python has *always* been obviously better than PHP (or perl, etc.)

      Article author: I know right? I mean PHP is like a toolbox .. with a hammer .. that has no hammer on it .. and the nails are made of wood!


      Meanwhile: PHP coder: *design design* *code code* Hey look, it's Facebook / Wikipedia / phpBB / phpMyAdmin / WordPress / Drupal / etc / etc !

      PHP coder: Nice work Zend, now we've got namespaces, anonymous functions, traits, magic quotes are deprecated, there's a new version of the Zend Framework! Your platform isn't perfect, but I like where it's going and I don't need a perfect platform to write solid code.

      --
      // MD_Update(&m,buf,j);
    16. Re:It's always been obvious by Johann+Lau · · Score: 1

      Where are the canned sites in Python? For that matter where are the canned sites in Perl or Ruby or whatever?

      Yeah, let's talk sites.

      Ruby: Twitter.

      PHP: Wikipedia.

      Python: I don't even fucking know.

      Your turn.

    17. Re:It's always been obvious by tibit · · Score: 1

      My "only" problem with PHP is something that would not make it any harder to use. It's the freaking inconsistency in design of the API: function naming, order of parameters, availability of complementary functions, functions that actually work and not pretend to (escaping ha ha). Fixing it would make it even easier to use and faster to learn. Why the fuck would a high level language expose C string API for example -- the very one that's misunderstood and unsafely applied by apparently most anyone who ever wrote any C code at some point in their life.

      --
      A successful API design takes a mixture of software design and pedagogy.
    18. Re:It's always been obvious by tibit · · Score: 1

      I meant to say: my problem is something that, were it fixed, would not make it any harder to use.

      --
      A successful API design takes a mixture of software design and pedagogy.
    19. Re:It's always been obvious by cas2000 · · Score: 1

      If your expertise is Perl, climbing the Python learning curve, gentle as it may be, isn't attractive,

      actually, the learning curve is trivial. it's not the obstacle.

      the obstacle is the million-and-one(*) different packaging systems for python modules/libraries. Perl has CPAN. Python has nothing comparable....it has *several* half-arsed imitations of it, but nothing that comes even close to being equivalent.

      the second obstacle is the general "i don't give a fuck about systems integration, *my* program/library is *special*, the system must adapt to me" attitude common to many python programmers. most sysadmins will get this point. many programmers won't, or will get it and think "yes, that's important, but *my* program really is special".

      disclaimer: i'm speaking as a long-time perl programmer who dabbles with (and really enjoys) python. i like programming in python enough that i've even managed to overcome my distaste for implicit braces (i.e. the white space issue, which seems to me to be a direct contradiction of one of the python maxims - "explicit is better than implicit"), but i won't see python as a viable substitute for perl until the python community sees it as part of the system, rather than a special case exception.

      (*) a very slight exaggeration

    20. Re:It's always been obvious by dbIII · · Score: 2

      The only people who have a problem with php

      There are other people - those that are pissed off finding some loser has cut and pasted some PHP script full of holes that should never have been there in the first place, and then to fix other people's work they have to learn enough PHP to change the thing to use the new version that is not full of holes. I suppose we hate the older versions of PHP, but mostly the clowns that used it without understanding how and those that copied them without understanding.

    21. Re:It's always been obvious by asdf7890 · · Score: 1

      A lot of the problem people have with PHP stems from the fact that it is ubiquitous and easy to program badly in. A fair number of people have had the joy of debugging or securing some terrible PHP code and that flavours their opinion of the platform.

      It wasn't without significant problems beyond that too though. The way objects operated was rather shite in v4 (I'm told this has been improved a lot, but people who have not tried a later version will not have adjusted their views accordingly) for instance, and the standard library while impressively proportioned was incredibly inconsistent (again, this I hope is likely to have improved since I last played in that area) due to its initial organic, unplanned, development.

      Of course another reason for the level of dislike shown by some is that in some circles you can look clever by having reasons to dislike something the people you want to look more clever than use...

    22. Re:It's always been obvious by Anonymous Coward · · Score: 0

      Python zealots are so annoying.
      Python is a noob language.
      Python ruins good developers.
      Guido van Rossum is the anti-christ.
      Go away!

    23. Re:It's always been obvious by budgenator · · Score: 1

      Where are the canned sites in Python? For that matter where are the canned sites in Perl or Ruby or whatever?

      Perl
      blosxom Perl Flat-file database 2.1.2 MIT 2008-10-02
      Bricolage Perl on mod_perl MySQL, PostgreSQL, Oracle 2.0.1 BSD 2011-02-09
      EPrints Perl on mod_perl MySQL, PostgreSQL 3.3.7 GPL 2011-12-10
      Exsite Webware Perl MySQL, PostgreSQL 3.7.2 GPL 2011-01-26
      Ikiwiki Perl Git (software), Apache Subversion, Mercurial 3.20120203 GPL 2012-02-03
      Movable Type Perl, mod perl, FastCGI, w/Php MySQL, Microsoft SQL Server, Oracle, PostgreSQL, SQLite 5.13 GPL 2012-03-01[5]
      TWiki Perl Plain files (under version control) 5.1.0[6] GPL 2011-08-20
      Scoop Perl on mod perl MySQL 1.1.8 GPL 2007
      WebGUI Perl on mod perl MySQL 7.10.24[7] GPL 2012-01-16

      Python
      Django-cms Python/Django PostgreSQL, MySQL, SQLite 3 and Oracle 3.1.0 BSD 2011-01-27
      MoinMoin Python Flat-file database 1.9.4 GPL 2012-02-21
      Plone Python/Zope MySQL, PostgreSQL, SQLite, Oracle, ZODB, via Zope 4.1.4 GPL 2012-02-27[41]

      Ruby on Rails
      BrowserCMS Ruby on Rails MySQL, SQLite 3.3.2 LGPL 2011-10-12
      Flagship Docs Ruby on Rails MySQL, PostgreSQL, SQLite 2.0 MIT 2010-02-02
      Radiant Ruby on Rails MySQL, PostgreSQL, SQLite, DB2[42] 0.9.1[43] MIT 2010-06-27
      Refinery CMS Ruby on Rails MySQL, PostgreSQL, SQLite 1.0.8 MIT 2011-05-27
      Typo Ruby on Rails MySQL, PostgreSQL, SQLite 6.1[44] MIT 2012-03-17

      --
      Apocalypse Cancelled, Sorry, No Ticket Refunds
    24. Re:It's always been obvious by Anonymous Coward · · Score: 0

      PHP coder: *design design*

      Liar.

    25. Re:It's always been obvious by cthulhu11 · · Score: 1

      Python has little to brag about: o_max = [l for l in output.splitlines() if 'MaxCapacity' in l][0] b_max = float(o_max.rpartition('=')[-1].strip())

    26. Re:It's always been obvious by Bonker · · Score: 1

      For that matter where are the canned sites in Perl or Ruby or whatever?

      http://rubyonrails.org/ IS the canned site in Ruby.

      The problem is that while Ruby is a nice, reasonable language that's pleasant for both new coders and experienced coders, Rails has its very own learning curve on top of that. One need learn Rails configuration options, its database abstraction layer, the ins and out of Rails itself, and the ins and outs of a double-handful of 'gems' (read: 'plugins') for commonly used website features like authentication.

      Now all that said, it's not a fun learning curve, but it's not exactly brutal, either. Once you get that mess down, you can 'throw up' a website in minutes... ...assuming you can find a webhost that supports rails.

      --
      The next Slashdot story will be ready soon, but subscribers can beat the rush and slashdot the links early!
    27. Re:It's always been obvious by sapgau · · Score: 1

      So... If I can replicate that code in assembler then I'm skilled?
      Sounds more like job security if you ask me.

    28. Re:It's always been obvious by geminidomino · · Score: 1

      Perl: Slashdot/Slashcode.

      Not sure if that's praise or damnation.

    29. Re:It's always been obvious by karlm · · Score: 1

      You misunderstand the saying. It's a poor mechanic who blames his tools for his mistakes because (1) he screwed up and (2) he perhaps knew his tools were bad but didn't even have the good judgement to get better tools (3) by his blaming demonstrates a lack of his ability to see (2) as an error and thus move on and grow.

      --
      Copyright Violation:"theft, piracy"::Anti-Trust Violation:"thermonuclear price terrorism"<-Overly dramatic language.
  33. Re:Fix? I think you mean, "migrate" by Daniel_Staal · · Score: 1

    That was just a short list. Others exist.

    If you want people to come from C-style syntax, have you taken a look at Perl? ;)

    --
    'Sensible' is a curse word.
  34. All Code will eventually be "Awful". Stop Whining! by ClassicASP · · Score: 1

    I'm primarily a Classic ASP specialist, and for years I've been hearing in blogs and tweets about how awful Classic ASP is. And now I've started doing a serious amount of PHP work professionally, here we go again with the moaning and groaning of how awful PHP is. I refuse to call the _language_itself_ awful just because I encountered frustrations when working on someone's website. Instead I place the blame on the original developer because they did things such as:

    - keeping their code really sloppy and unreadable
    - not leaving comments explaining what the code does
    - using ambiguous variable names that don't have any relevance at all to their purpose
    - poorly named functions and classes
    - jamming 7000+ lines of code into a single database stored procedure (with similar problems as described above)
    - hardcoding things that should have been database driven with an administrative control panel
    - OVERKILL on object oriented coding, thus sending you all over the damn place to fix something that could have been much shorter and simpler
    - too many layers of technologies working together to accomplish something simple, so to fix, you have to read an page which uses a DLL, which calls a stored procedure, which queries a view, which queries another view, which queries another view, which queries a table, which triggers a......

    This kinda stuff can happen in any language, and in time, you'll find another language to complain about. 5 or 10 years from now you'll be touting that Java sucks! Don't hate the code. Hate the coder who fled the scene of the incident and left you with a mess to deal with.

  35. PHP by Anonymous Coward · · Score: 1

    All languages (linguistic, programming, etc) suck for one reason or another. Trying to impose order or ideological structure on something that's inherently chaotic and entropic in nature misses the point -- languages exist to bridge gaps, and if a double-claw hammer is needed by some crazy loon for something, then one will be made -- look at the conjugations of the verb "to be" as a spoken language equivalent. Meaning and order change and deteriorate over time to suite the gaps of the day that need to be bridged.

    Which brings us to PHP. Yes, it's a mess. However, it's a highly functional, easy to implement, powerful mess that a good programmer can write the code equivalent of Shakespeare with. So, instead of trying to solve a problem that doesn't exist if you don't have Autism, how about doing something useful like streamlining javaScript?

  36. HUH? by willy+everlearn · · Score: 1

    Love PHP. The list of successful php deployments is huge.

    --
    No hour on a horse is ever wasted. Winston Churchill
  37. Bad compared to what? by Shag · · Score: 2

    PHP may feel bad compared to currently-popular languages like Ruby and Python, but consider what it was an alternative to when it first came out: ASP and ColdFusion. Can anyone who worked in either of those honestly say that PHP is as bad, let alone worse? I certainly found it less awful than CF for web dev (and that's speaking as someone who'd been getting paid to program since before there was a web).

    --
    Village idiot in some extremely smart villages.
    1. Re:Bad compared to what? by shutdown+-p+now · · Score: 1

      PHP was better than classic ASP, yes, but that was 10 years ago (and both Python and Ruby already existed back then, they just weren't that popular). But why should we consider the relative merits of technologies from a decade ago when judging them today?

    2. Re:Bad compared to what? by Anonymous Coward · · Score: 0

      Even that is debatable. ASP had a sane database library from the beginning, as well as things like XML parsers that actually worked. Also, it could be used with server-side Javascript, which certainly isn't any worse than PHP linguistically. A dozen years ago, PHP/MySQL seemed like a huge step backwards from ASP/MSSQL, although they've patched over most the rough parts by now.

  38. Re:Hipsters by jwegman · · Score: 1

    Ding, ding, we have a winner!!!

  39. Re:Good things about PHP by hey · · Score: 2

    mod_php the Apache module.

  40. The problem... by jemenake · · Score: 2

    Seems to me that the problem is that people outgrow what PHP can do for them, partly lured by PHP's own efforts to offer more than what it should do for them... but, even though they've outgrown it, they stick with it.

    When it came out, it was really handy for throwing in some server-side functionality into your HTML. Unlike Perl, where you'd have to have print statements all over the place, or load templates and replace keywords, PHP let you just in-line your functions with your HTML. (Sure, there were earlier solutions like this, like ASP but... ew!). So, it's a great first web-development language... like BASIC was for PC programming. Like BASIC, the problem came when you never realized that it was time to "leave the nest" and move on to something more rugged, J2EE, AJAX, .NET, take your pick of oodles of alternatives. Instead, people just kept asking that PHP be extended to do a bunch of kooky crap that it never was meant to do.

    So, to address the original post, there's kinda no hope in trying to fix what's messed up with it, because there's *way* too big of an installed base... and most of what's messed up about it is that people are using it for larger projects than they should be.

    1. Re:The problem... by Anonymous Coward · · Score: 0

      HTML::Mason.

    2. Re:The problem... by Tablizer · · Score: 1

      Instead, people just kept asking that PHP be extended to do a bunch of kooky crap that it never was meant to do.

      One sign of true success is expanding beyond your original niche such that people bitch about it not matching the new niches.

      It's difficult to make a one-size-fits-all language that makes everyone happy.
           

    3. Re:The problem... by Anonymous Coward · · Score: 0

      What? AJAX is not a programming language

    4. Re:The problem... by wmbetts · · Score: 1

      Ajax is more rugged than PHP? I hope you're kidding.

      --
      "Ubuntu" -- an African word, meaning "Slackware is too hard for me". - stolen from Dan C alt.os.linux.slackware
  41. Hmmm... by Elminster+Aumar · · Score: 1

    From every Java project I've ever worked on, I always found myself thinking, "...PHP can do that." Can it do it better, though? Not sure. I lack the experience to make that determination. All I know is that I have yet to be given anything that PHP can't do that Java can. Not saying either-or is better here because we all know that these sensationalistic stories boil down to what's required for a given project. If it works, use it. Let's not have anymore of these stupid civil wars for crying out loud. There's more than enough clientele for us all. :.)

  42. Language is irrelevant by Anonymous Coward · · Score: 1

    I would take a good programmer who uses PHP over a bad programmer who uses Java any day. When it comes down to it, every programming language has it's weaknesses, but a good programmer knows how to avoid them. I think that the reason that people think PHP is such a bad language is that it's so easy to pick up but hard to be good at it, so a lot of people who say they are "PHP Programmers" really just have a basic grasp of the language. And there will ALWAYS be bad programmers who are good at convincing non-tech folk that they are amazing, because all they can see or know is the end result. Bad programmers are bad programmers, language is irrelevant.

    1. Re:Language is irrelevant by shutdown+-p+now · · Score: 0

      "Do not tell me that “good developers can write good code in any language”, or bad developers blah blah. That doesn’t mean anything. A good carpenter can drive in a nail with either a rock or a hammer, but how many carpenters do you see bashing stuff with rocks? Part of what makes a good developer is the ability to choose the tools that work best."

    2. Re:Language is irrelevant by tbird81 · · Score: 1

      But PHP isn't really using a rock. It's like using a portable, light-weight and ubiquitous nail gun. In many cases it's quicker and easier to get those nails in, but for certain situations might be inappropriate and compromise the stability of the house you're building.

    3. Re:Language is irrelevant by shutdown+-p+now · · Score: 1

      PHP is using a rock instead of a hammer, that's the whole point. There's nothing light-weight about it or portable. Ubiquitous it is, but so are rocks (relative to hammers). The article from which I had quoted - which is linked to from my sig - discusses it in more detail.

  43. Value is more than one thing in a language by Bozovision · · Score: 1

    The OP thinks that the value of a language is chiefly technical, but that's not the whole story.

    The value of a language is made up of:
    - The value embedded in its ecosystem of developers - both core and users
    - The value of its libraries
    - The value/cost of deployment
    - The cost of maintenance
    - The cost of adoption - how much does it cost to bring a new person up to speed
    - The technical elegance of the language
    - The costs associated with a failure
    - And probably some things that I've forgotten, or which are specific to a particular project

    For a particular project, each of these things have relevance with different weights - so it doesn't matter how messy a language is if the value in everything else outweighs the problems caused by the inelegance of PHP (or any other language).

    A viable replacement for PHP (or any language) has to provide 10x the benefit for a class of problems to be taken up at any scale; for anything less than that the risks of using the new language are outweighed. It turns out that this is very very hard to do: there are still many COBOL systems; new programs are still written for Fortran; and Lisp, and Lisp derivatives, despite their beauty, have not taken over the world.

    What propels a language to glory is its ability to dominate a niche while that niche is growing, but once that niche has reached stability, or perhaps a critical mass, it's next to impossible to dislodge. Don't look to see PHP go away while traditional web is important.

    So, if the OP is really interested in languages that are better than PHP, looking at web development as a whole is unlikely to be successful. But a language that engaged a growing niche which PHP will need to compete for at least has some chance of succeeding. The closest possible thing I can think of at the moment would be a language which was fantastically well-adapted to HTML5. Or maybe one that understood dynamic layout in its bones. Or was very well adapted to mobile or mobile web.

    Other than those possible areas, to grow a language, it had better target a new form factor problem/niche - e.g. virtual reality/Google glasses.

  44. Re:Good things about PHP by Anonymous Coward · · Score: 1

    C is increasingly a bad structure for languages, as improvements come in

    No, it really isn't. It's just as good a structure as it ever was, which is very darned good indeed. That doesn't stop people from using it poorly, of course. Lousy c programmers are everywhere, just as lousy php, python, perl programmers are everywhere. Most c code I see on the net is awful. It didn't help that the original K&R writing style was quite poor, either. But good programmers have been past those hurdles for decades now. There just aren't that many good programmers.

  45. The next step is Groovy? by i_ate_god · · Score: 2

    As much as I like python, Groovy seems like the logical next step.

    It's dynamically typed, it has a similar syntax, it can be procedural and oop, it has access to 99% of the java ecosystem. The learning curve from PHP to Groovy is much smaller than python I'd imagine.

    Just replace Zend Framework/Symphony with Swing, Apache HTTPD with Apache Tomcat, remove $ from variable names, and while "this" may not be required, it certainly makes code easier to read and is more in line with php, and replace -> with a period.

    Voila... the post-php world has arrived. With a language that has more similarities syntax-wise with Javascript, the flexibility of PHP with the option to be as strict as Java, and access to a wealth of superb libraries.

    --
    I'm god, but it's a bit of a drag really...
    1. Re:The next step is Groovy? by zzyzyx · · Score: 1

      Switching to Python however is just a matter of changing the P in your LAMP server, while Groovy requires a more substantial change in infrastructure, and somewhat beefier system needs.

      Let's face it, as long as free hosting provider will have PHP available and nothing else, PHP will thrive. I bet most people who use PHP today first used it there.

    2. Re:The next step is Groovy? by Lennie · · Score: 2

      Most PHP-programmers wouldn't touch Java with a stick. Java has to many properties of what PHP programmers consider bad.

      --
      New things are always on the horizon
    3. Re:The next step is Groovy? by devent · · Score: 1

      Why is "dynamically typed" the "next logical step"? I like Groovy and I'm using it daily but most of the time in Groovy I try to figure out what methods I can use on the parameter. And I get little angry why Groovy can't offer auto-completion for a type I used 5 lines above.

      --
      http://www.mueller-public.de - My site http://www.anr-institute.com/ - Advanced Natural Research Institute
  46. Re:Recursive? No, very iterative. by alex67500 · · Score: 5, Insightful

    Ever since programming languages existed, they have been classified in 2 categories:
    - Those every one bitches about,
    - and those nobody uses...

  47. An Open Web by Wandering+Voice · · Score: 1

    Im a self-taught hobby user, I do not have any formal education with programming or computer science. My first language was Python even before HTML & CSS. So my opinion may be biased in favor of Python. It was in 2009 that I finally decided to dig in and learn some PHP and MySQL.

    Personally, from my perspective, I think that PHP is a messed up looking language and not very intuitive for me to work in. I much prefer Python, though I do notice the difference in how well my CGI scripts performed compared to PHP versions. I am not familiar with any of the PHP or Python website framework tools. I build everything by hand.

    I first got online in the late 90s and liked the philosophy of the web being an open place where anyone can publish anything they want. HTML was easy to learn and generally effective, but static pages end up taking a lot of time to maintain and a lot more time yet, should the design change. A dynamic database backed site, while a little more complex, can make maintenance and modification a bit easier and more fun. While PHP isn't ideal, it does work. I would like to see something more Pythonic available though. I think this would help lower the barrier to being able to build simple web based tools or sites for common users.

    As it is there is already quite a lot to learn and grasp to begin to make an appealing website. Graphics and visual presentation, site/data organization, html, css, web host, general computer and internet, and then there are databases and scripting languages if the developer want to get the most out of their site or tools. I'm not saying this is hard stuff to learn. Though it is time consuming. I think though anywhere it can be made easier for the common user to learn, and learn properly, would be best for us all.

  48. Re:Good things about PHP by Anonymous Coward · · Score: 1

    It tricks non-programmers into thinking it does by putting the code in the middle of the HTML page so it looks like the HTML renderer is executing the PHP, instead of having the PHP generate the HTML which is what actually happens and how every other language represents it

  49. Re:Good things about PHP by omnichad · · Score: 1

    That's a web server. A browser is the client to the web server. Do you know you're not making sense?

  50. Re:Fix? I think you mean, "migrate" by billcopc · · Score: 5, Insightful

    This.

    PHP feels natural for me, as a C guy. The library functions lack consistency, but then neither do 3rd party C libraries. You just learn how to work them and get on with your billable day. I can look at just about any PHP code and figure it out pretty quickly. A lot of it is written by mental midgets, but it is familiar enough that I can jump in and fix whatever needs to be done.

    Meanwhile, all those other, functional languages venture so far off the beaten path as to make them look like gibberish. They often strike me as the product of overexcited college grads. It's like a little kid who just learned a new swear word and starts using it ten times in every sentence. Closures this, aspects that, ooh look ma I'm using list operators... academic functionality makes for cute sample code, but those of us with actual jobs have more pressing things to do than learn a new language and syntax. At the very least, PHP offers a good online manual with some very handy user-contributed snippets. Sure, some of them are ass and could benefit from some karma/moderation system, but I've often found a little 10-line function in those comments that saved me an hour of poking around, or that I could patch up and post my improved version. That right there beats all those "Look how easy RoR is" screencasts that ignore all the actual things programmers need to know to write secure, production-ready code.

    --
    -Billco, Fnarg.com
  51. Re:Good things about PHP by lucifuge31337 · · Score: 1

    mod_php the Apache module.

    As much as I try, I can only get mod_php to load in a web server. My browsers don't seem to know quite what to do with it.

    --
    Do not fold, spindle or mutilate.
  52. I'm not smart enough to know the difference by Anonymous Coward · · Score: 0

    I'm not a computer scientist, I'm not smart enough to know that PHP sucks.
    I do know that if I need some kind of quick dynamic site on the web, PHP is the best and only choice.

    Reasons:
    cheap web hosting
    simple db connectivity
    fast
    low memory footprint
    simple syntax
    no 'secret conventions' or config files
    simple deployment
    'just works'

    Alternatives?
    JAVA: JSP pages, servlets
    Ruby: Rails
    Python: Django, Cherry PI
    Perl: Mason (ever install this!), CGI
    Others?

    Nothing else even comes close to PHP for what it does right.

    Sure PHP is a non-designed, hodge-podge of functions but it fills a void no properly designed language has been able to fill.
    No language is perfect, if you can name a language you cant complain about, you haven't used it enough!

  53. Re:Cheap web hosting with SSL and non-PHP? by Anonymous Coward · · Score: 0

    reported as spam

  54. Re:Good things about PHP by Anonymous Coward · · Score: 0

    You run Apache in your browser? Did you purchase that UID?

  55. writing JS with PHP is the disaster by Anonymous Coward · · Score: 0

    I am usually updating other people's code and the biggest mess and waste of time is writing Javascript code from PHP and forgetting what file you are in or "forgetting" . "that" + "each" + "language" . "does" . "things" slightly differently. Just different enough to make you hate them.
    And while I'm at it, in general, why can't all the lanugage just agree on the basics. They all implement foreach, and they all have to have a different syntax. wtf? seriously, are the authors of these languages so egotistically that they can't follow eachother on the basics.

  56. The problem, of course, is people by gestalt_n_pepper · · Score: 1

    The community of programmers splits sloppily into "I want something understandable and easy to use" (VB6, PHP) and "I want something internally consistent and aesthetically pleasing from a mathematical standpoint (Powershell, C++, Pascal).

    Neither side is entirely right, or wrong. Any good programming language should be both consistent AND immediately understandable by a human with only programming language concepts as background knowledge. Thus far, such an animal is imaginary, despite what the Python folks think.

    There's a subset of self- absorbed, arrogant twits that believe that if a programming language is "too simple," it's just wrong and You. Just. Don't. Understand. REAL. Programming! I tend to filter them out as noise and recommend you do the same.

    --
    Please do not read this sig. Thank you.
    1. Re:The problem, of course, is people by Again · · Score: 2

      There's a subset of self- absorbed, arrogant twits that believe that if a programming language is "too simple," it's just wrong and You. Just. Don't. Understand. REAL. Programming! I tend to filter them out as noise and recommend you do the same.

      Yeah, you're right. I hate PHP because exceptions like "Unexpected T_PAAMAYIM_NEKUDOTAYIM" are just too simple. Or how about this line of code: if(new stdClass() instanceof get_class(new stdClass()).... Just try it. Or how about this error message: "Fatal error: Exception thrown without a stack frame in Unknown on line 0". Why not just stick to the classic message: "lol error".

      PHP is full of these weird errors, odd behaviours and inconsistency and you have the nerve to say that programmers are complaining about it being too simple.

    2. Re:The problem, of course, is people by gestalt_n_pepper · · Score: 1

      No, actually, I was thinking about a comment I read on Slashdot where a russian programmer criticized VB6 as "too simple." He sort of typified what was wrong with a certain class of mathematicians and programmers.

      As for what you're describing, I'm with you on those. FYI, I prefer error message Haiku (http://www.gnu.org/fun/jokes/error-haiku.html).

      --
      Please do not read this sig. Thank you.
  57. Wt by scorp1us · · Score: 1

    Of we assume that OOP is a good paradigm in general, then there should be some way to construct server-side software in OOP, and not worry about the transport in HTTP. And whereas PHP has OOP bolted on later, maybe this language had it from the start?
    While Python and Ruby are good, I'd like to talk about a gem i found called Wt

    Wt is a spin off of Qt, but rahter than being client app focused, it is web app focused. it is programed in much the same way as Qt, but uses the Boost API proper, not some boost-inspired API.

    It supports AJAX and you can even mark C++ functions for export to JS so they run client-side.

    The problem is, if you're not used to thinking OOP about websites, and not used to Qt or Boost, the, your learning curve might be a bit longer than you'd like. Also, deployment is not as simple as dropping PHP files into the right spot in a file system.

    http://www.webtoolkit.eu/wt

    --
    Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
    1. Re:Wt by scorp1us · · Score: 1

      I would like to add that there has been a paradigm shift in web programming over the last 20 years.

      We went from whole-page loads and opaque submission of forms via POST to a Web 2.0 (AJAX+JS) method. Browsers are now only a way of collecting events, sending them to a server and getting the result back. PHP was written to deal with those opaque forms - where you get the whole lot of variables, and render the whole page. But really what we have today with AJAX is a whole new paradigm. Taking that into account, a return to event-driven programing seems to be the way again.

      Wt is perfect for that.

      --
      Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
  58. I am a PHP user by FsG · · Score: 1

    I am one of those "stupid" PHP users. It's not the first language I learned, nor is it the last. I'm well aware of Python as an alternative for developing web apps, and I've tried it, but I really do prefer PHP.

    One reason is flexibility in flow control. PHP has do ... while loops. Also, I can do "continue 2" or "break 2" if there is a loop within a loop, to continue or break at the outer loop. I'm honestly puzzled that Python still hasn't added these obvious and useful things.

    I've asked Python types about this, and gotten reasons like "you shouldn't be doing that in the first place," which pisses me off and makes me want to stick with PHP even more. I mean, who the hell are they to tell me what I should and shouldn't do? This tradition of "I know better than you do" seems to permeate Python, and leaves a bad taste in my mouth. PHP gives me the freedom to do what I want -- and that includes doing mysql escaping badly. That's not a freedom I will use, but it's there nonetheless.

    People are right to criticize PHP's mysqli library, but there are plenty of good wrappers available that hide the problems, or you can just use prepared statements exclusively and avoid the whole mess. Again, PHP doesn't preach at you with a "I know better" attitude, it just gives you all possible choices and lets you take it from there. PHP tutorials are wrong to teach mysql without teaching security and injection prevention, but that doesn't take away from the language -- there are bad Python tutorials out there too.

    Also, PHP's tradition of having a standard installed system makes it trivial to ship code. If a certain class isn't part of the standard PHP installation, you package it with your app -- and you know for sure what your user's environment will look like. True, there are the configurable php.ini settings, but those are trivial to check and adjust within your code. With perl or python, one shared hosting company might have certain packages installed while another one does not, so companies shipping apps go insane trying to figure out what they're allowed to rely on. Users without root might, or might not, get to bring in certain things on their own. And if they can pull in the right packages, the process might be too complicated for the given user, or might require shell access which the hosting company disallows.

    The fact that there are so many successful PHP apps running on shared hosting (wordpress, vbulletin, etc) is a testament to how simple the language made it to ship and deploy such apps. It's historically been easier for a webhost to support PHP than to support Python, so more of them do it. From the developer's perspective, you know a given PHP app will run the same on all installed sites since they all have the same base libraries. From the user's perspective, it's dead simple to deploy the app with nothing more than an FTP client. No need for root access or any weird tech stuff. From the webhost's perspective, a trained monkey could deploy PHP on a server -- not just today, but 10 years ago.

    I hate to put arguments in my opponents' mouths, but so often I've heard Python types attack the quality of those PHP apps. In my opinion, though, you can't argue with their success. PHP delivers what users need, and in the end that's all that matters.

    --
    I made a PHP/MySQL library that prevents SQL injection & makes coding easier!
    1. Re:I am a PHP user by cockpitcomp · · Score: 1

      And only have one return statement and declare all your variables in one place with comments...in alphabetical order.

    2. Re:I am a PHP user by DrVomact · · Score: 3, Interesting

      I am one of those "stupid" PHP users. It's not the first language I learned, nor is it the last. I'm well aware of Python as an alternative for developing web apps, and I've tried it, but I really do prefer PHP.

      One reason is flexibility in flow control. PHP has do ... while loops. Also, I can do "continue 2" or "break 2" if there is a loop within a loop, to continue or break at the outer loop. I'm honestly puzzled that Python still hasn't added these obvious and useful things.

      I've asked Python types about this, and gotten reasons like "you shouldn't be doing that in the first place," which pisses me off and makes me want to stick with PHP even more.

      I'm going to tell you what you don't want to hear, and I'm going to tell you because it's true: you shouldn't be doing that. The reasons why you shouldn't be doing that have nothing to do with any one programming language, they are general to all programming languages. They are the same as the reasons why you shouldn't have GOTO statements, and these things were learned near the very beginnings of the study of programming as a discipline.

      There are far too many people who equate the invention of new programming language with "progress". It ain't so. That being said, it's probably possible for a good programmer to write good code in any language. (I say "probably" because I don't know all the languages, including PHP.) However, not all programmers are equally good, so it might be wise to stick to languages that won't let you commit atrocities.

      --
      Great men are almost always bad men--Lord Acton's Corollary
    3. Re:I am a PHP user by FsG · · Score: 2

      I'm going to tell you what you don't want to hear, and I'm going to tell you because it's true: you shouldn't be doing that.

      ..and I'm going to ignore you and do what I wanted to do anyway. If my current tool doesn't allow it, I'll switch to one that does.

      But insults aside, I think the way in which you said "you shouldn't be doing that" without even bothering to explain why, is part of the problem. You're basically saying that you know better than me, so much so that you shouldn't even have to persuade me, that I should just accept your superior knowledge. That approach never works, and it's pretty insulting to be on the receiving end of it.

      If you want to advocate a better way or explain why "continue 2" is bad, you can certainly do that, but just trying to force your position upon everyone isn't the answer. If you try, someone else (in this case, php) will come along and give the people what they want.

      --
      I made a PHP/MySQL library that prevents SQL injection & makes coding easier!
    4. Re:I am a PHP user by Anonymous Coward · · Score: 0

      ... nice textboook reply

      the reason GOTO was bad is that the languages never enforced scope for the statement
      so if you're in your little function nested 5 levels deep in your call stack and you encounter "condition z", you could jump straight back to the start of the code
      while there "could" be a valid reason for abandoning the current call stack, odds are it's not a good one

      i see nothing wrong with do while loops
      that are times you always want one iteration of the inner block before checking end conditions
      adding a little "isFirstRun" check in the break condition is stupid as it wastes time checking for something that will only occurs once in, possibly, several billion iterations of the inner block

      as for "continue 2" and "break 2", these are generally fine as they don't jump to arbitrarily placed "labels"
      instead it signals a particular level of loop / switch processing should be abandoned
      you could replace this by having the block as a separate function then 'return'
      that's less efficient though as you have to pop/push the call stack
      the "normal" way would be to set a flag to check later in order to skip code
      reading the code though, you need to check further to see if there's further processing ignoring the flag
      with 'continue/break' it tells you to back track a little (for the case of loops anyway)
      my only issue is with it's syntax (ie. does "continue 0;" work? does "continue 1;" == "continue;")

    5. Re:I am a PHP user by Cl1mh4224rd · · Score: 1

      However, not all programmers are equally good, so it might be wise to stick to languages that won't let you commit atrocities.

      Never underestimate a person's ability to fuck things up.

      --
      People will pass up steak once a week, for crap every day.
    6. Re:I am a PHP user by tbird81 · · Score: 1

      An obvious retort is: "Assembly uses "goto" statements."

      Another is "What's the difference between breaking out of a loop with a "break 2" statement, and changing a variable that causes the loop to end?"

      I'm not a programmer, and have never done computer science*, and I've never read anything about these theories, AND I only have a basic idea of some things that are probably fundamental to programming. But (for the GP) I'll give my explanation of why I think gotos and breaks are meant to be bad. I don't know if I'm completely off track, but at least I'm giving an answer. (The PHP philosophy :-P)

      I like to think about what happens when the program is turned into machine language (and interpreted languages have the same concepts). Programs use something called a stack. This is a list of numbers, and the analogy is like a stack of plates. You put a plate onto the stack, and if you want to remove one you have to take the top plate.

      This is how when you call a function, the program passes on the parameters of that function. So if you have f(a,b), parameters 'a' and 'b' will be put on the stack. Inside the function, a and b are taken off the stack. If you've got many functions inside other functions, the stack increases - you keep adding more plates, and the functions will then take each plate and deal with it (if you look at asm, that's what all those pops and pushes are about). (A similar thing happens in nested statements.) The deeper nested you are, the larger the stack will be, but it doesn't really matter, as each function just deals with the "top plates". Basically after calling a function and getting the return value, the stack will be back to its state before this.

      By using gotos and breaks, you go to another position, without necessarily ensuring that the stack is how it should be. Obviously, the programming language should sort this out for you and gets things back to how they should be, but it sort of breaks the "niceness" of dealing with each function at a time.

      *Disclaimer - yes I'm talking out my ass.

    7. Re:I am a PHP user by Anonymous Coward · · Score: 0

      There are times that GOTO can be useful.

      For example, converting a batch file to a PHP script to make a command line program would be alot easier with goto in certain situations.

    8. Re:I am a PHP user by rev0lt · · Score: 1

      They are the same as the reasons why you shouldn't have GOTO statements, and these things were learned near the very beginnings of the study of programming as a discipline.

      While I'm no fan of "goto" (or similar instructions) in high-level languages, the academic hatred for it is mostly based on dogmas, not facts. There are use cases for goto's, some algorithms will actually run faster (in some languages) and still be readable, and the notion that promotes sloppy code is, well, a dogma.
      The biggest problem with "programming as a discipline", is that most times it is started from scratch - the students (and more often than not, the teachers) have no clue about how technology works, and they push structured concepts that really don't exist on a microprocessor level, and only later (if ever) they dwelve in how code is actually executed. The fact is, that for the most part, digital platforms rely mostly on "gotos" and "compares", and because those students started learning it "the high level way", they usually don't have a clue about the tradeoffs of choices like "using gotos". Instead they tend to pile up procedure calls and trash up stack and heap space, because that is "the right way" . Yes, I'm aware that this is PHP-related, and that some of the things I said don't apply, but I'd happly use a goto to prevent a function call on a demanding algorithm. Denying that possibility based on *no arguments* is dumb.

    9. Re:I am a PHP user by Anonymous Coward · · Score: 0

      In languages without goto people just mimic it with exceptions, which is retarded. goto is useful. Even Lua 5.2 added a goto because many common constructs are just plain awkward without it, especially complex constructs you use in parsing.

      goto apologists have all kinds of rules, like only use goto to break out of nested loop, only use goto to jump further down the function, only use goto to exit. The best rule for goto is don't be stupid. Unlike in days past, structured statements are everybody's habit, so using goto only ever comes to mind when the regular structured statements feel awkward or burdensome. Anyone less than 70 has to put effort into abusing goto.

    10. Re:I am a PHP user by Anonymous Coward · · Score: 0

      Also, I can do "continue 2" or "break 2" if there is a loop within a loop, to continue or break at the outer loop. I'm honestly puzzled that Python still hasn't added these obvious and useful things.

      I've asked Python types about this, and gotten reasons like "you shouldn't be doing that in the first place," which pisses me off and makes me want to stick with PHP even more.

      If they didn't bother to explain the reasons they weren't being very useful, but if you didn't bother to listen then you weren't being very useful. Let me give it a try.

      Each loop in a series of nested loops has a function in the whole, together with code before and/or after it to prepare for the loop and/or finalize the results. Continuing and breaking the way you describe can easily result in having inner loops decide to skip initializations and/or finaliziations of outer loops. The skipped code may not be there yet when the continue/break is coded, it may be added later in development or maintenance. Doing this amounts to having one functional unit interfere with another (which is a useful way of looking at your code even if they are nested loops within the same function body), or in other words the functions get intermingled (often referred to as spaghetti code). By regarding them as separate functional units you can more easily refactor loops into separate method or function bodies, and you can add code before or after a loop without the surprise of code somewhere else deciding it isn't to be executed in some circumstances. Your code becomes more predictable, easier to understand and easier to maintain.

      You probably feel you don't need this, and I have no doubt that you don't have a problem overseeing the code you write. Why do it anyway?

      • You're not the only one working on that code. Others may be less capable than you.
      • You may not always be as sharp as you are now. People do get overworked (and don't think that can't happen to you, one major reason it happens is that people don't see it coming), people do have crises in their private lives that demand a lot of their energy. You may experience periods in which you're just too tired or distracted to oversee everything you can oversee now.
      • Even if you can oversee it, nobody has unlimited brain capacity. By programming in a way that takes less of that capacity (by not having to deal with the kind of interactions you create) you have more available for higher abstraction levels, which enables you to write more advanced software.

      I learned this by getting seriously overworked, having personal crises, by having been so exhausted I could only do my work by dividing it into small pieces that were stupid enough for me to understand while in that condition. And when I returned to my normal capabilities I found the new habits I learned enabled me to build far more advanced software than I had been capable of before. It made me a better programmer.

    11. Re:I am a PHP user by DrVomact · · Score: 1

      ..and I'm going to ignore you and do what I wanted to do anyway. If my current tool doesn't allow it, I'll switch to one that does.

      But insults aside, I think the way in which you said "you shouldn't be doing that" without even bothering to explain why, is part of the problem. You're basically saying that you know better than me, so much so that you shouldn't even have to persuade me, that I should just accept your superior knowledge. That approach never works, and it's pretty insulting to be on the receiving end of it.

      If you want to advocate a better way or explain why "continue 2" is bad, you can certainly do that, but just trying to force your position upon everyone isn't the answer. If you try, someone else (in this case, php) will come along and give the people what they want...

      I'm sorry that you felt insulted by my comments; that was not my intent. I suppose that, by repeating the criticism, I was acting along the lines of "If one man calls you an ass, ignore him; if three men call you an ass, get thyself a saddle". Or, I would say, maybe you should check if you've been fed too much hay. I have better things to do than to wait around for chances to insult fools; there are other ways of wasting time that I enjoy much more. The fact that I am willing to risk insulting you means that I think you are not a fool.

      Second, I am by no means a Guru, but I got into the programming game very early, and I took the advice of people who got into it even earlier, and who are far better programmers than I will ever be. Truly, I am not fit to even polish their sandals. Sometimes, the advice was couched in terms that were not very flattering ("Hey, that's dumb. Do it this way.) Because I respected the experience of these elders, I would try out their way, and try to understand why it might be better than mine. Sometimes it wasn't. Of course you don't know me, and have no reason to give me the slightest degree of respect. However, the fact that you are hearing so much criticism of PHP ought to make you at least look at this criticism closely. There's plenty of stuff out on the Web about this issue, so reasearch might be indicated.

      I don't even know PHP, and have no long-standing animosity to it. My web programming has been done in Perl CGI. I don't think that Perl is the One True Way. Python is not a bad choice either; I don't like Python (for what seem to others like arbitrary reasons), but I respect the language. I'm tired, it's late, etc. but I did a quick search for this break 2 statement you were talking about. I found the following code snippet at this site (I'm sorry about the munged indents; I don't recall how format code in HTML right now):

      $i = 0;
      while (++$i) {
      switch ($i) {
      case 5:
      echo "At 5\n";
      break 1; /* Exit only the switch. */
      case 10:
      echo "At 10; quitting
      \n";
      break 2; /* Exit the switch and the while. */
      default:
      break;
      }
      }

      OK, this grates on me, but it's not hard to understand what it does. It doesn't seem obviously evil. But further down that same page, there is the following comment:

      If the numerical argument is higher than the number of things which can be broken out of, it seems to me like the execution of the entire program is stopped. My program had 8 nested loops. Didn't bother counting them, but wrote: break 10. - Result: Code following the loops was not processed.

      Say what??? "break 2 seemed innocuous, if kludgy; but I didn't understand that you could use just any index after the break. And apparently the PHP interpreter or compiler or whatever does no checking on the index. So you could have break 10 or maybe 250. Maybe this would work as you intended when you first wrote it, but can you really not see h

      --
      Great men are almost always bad men--Lord Acton's Corollary
    12. Re:I am a PHP user by Anonymous Coward · · Score: 0

      I am one of those "stupid" PHP users. It's not the first language I learned, nor is it the last. I'm well aware of Python as an alternative for developing web apps, and I've tried it, but I really do prefer PHP.

      One reason is flexibility in flow control. PHP has do ... while loops. Also, I can do "continue 2" or "break 2" if there is a loop within a loop, to continue or break at the outer loop. I'm honestly puzzled that Python still hasn't added these obvious and useful things.

      I've asked Python types about this, and gotten reasons like "you shouldn't be doing that in the first place," which pisses me off and makes me want to stick with PHP even more.

      I'm going to tell you what you don't want to hear, and I'm going to tell you because it's true: you shouldn't be doing that. The reasons why you shouldn't be doing that have nothing to do with any one programming language, they are general to all programming languages. They are the same as the reasons why you shouldn't have GOTO statements, and these things were learned near the very beginnings of the study of programming as a discipline.

      There are far too many people who equate the invention of new programming language with "progress". It ain't so. That being said, it's probably possible for a good programmer to write good code in any language. (I say "probably" because I don't know all the languages, including PHP.) However, not all programmers are equally good, so it might be wise to stick to languages that won't let you commit atrocities.

      Let's get something clear hear and now -- breaking / continuing loops by ID? Yeah, that's probably not a good idea for anybody. But there is nothing wrong with the do ... while loop. There are many instances where it is appropriate to execute a loop at least once before checking the sentinel condition. Python should probably catch up with that part, IMO

    13. Re:I am a PHP user by Anonymous Coward · · Score: 0

      It's a good thing I'm anonymous today, because I can't spell 'here' correctly while arguing fine points about development languages!

    14. Re:I am a PHP user by Anonymous Coward · · Score: 0

      An obvious retort is: "Assembly uses "goto" statements."

      An obvious retort to your obvious retort is: "There are reasons why most people don't program in assembly."

    15. Re:I am a PHP user by yeltski · · Score: 1

      He didn't miss your point, you missed his. Do you have a CS degree? A mathematics degree? Do you know exactly why you need to change oil when they tell you to, and does it make you mad if a mechanic doesn't want to explain why? This is why we have Computer Science, it is smart people figuring out what you should do, so you don't have to. If you really want to understand all the reasons why you should use 'continue 2', you need to find a CS professor, and pay for a class.

  59. There you go, Mr. Atwood... by Burz · · Score: 1

    Ignoring the "worse is better" and whitespace comments, I'd say from the comments here that the way to go with your project is to make Python scripts easier to deploy and manage on LAMP. Specifically, I'd make sure that user sessions were not managed under a single, monolithic instance; also I'd implement a way for Python to effortlessly share web session data between instances (in a way that doesn't compromise security).

    Another commenter suggested Groovy as an alternative, although I'd bet that suffers from Java's monolith and memory footprint issues.

    1. Re:There you go, Mr. Atwood... by crispytwo · · Score: 1

      Groovy is OK. Your suspicions are correct. Debugging it is sometimes worse than pure Java because you really don't know where it actually broke. If we are talking about web development, then probably looking at Grails - which doesn't run the same on development as in deployment. On top of that, It makes assumptions that I don't like. It does have some nice features nevertheless.

  60. PHP is not that bad, really! by dejanc · · Score: 1

    PHP seems to be the new language to hate, just like JavaScript once was. There are things wrong with it, but really, it's not that bad!

    The reason why a lot of current PHP code sucks is that many popular CMS started back in the days of non-OO PHP and were written by people who had no idea about design patterns. Software like Wordpress, Drupal and Joomla (which are all widely deployed) were originally written in procedural PHP 4, misusing PHP's power as templating language. Software like that, where programmers mix HTML, database calls and business logic can never be fixed, only rewritten.

    On the other hand, modern MVC frameworks, like Zend or Symfony or CodeIgniter provide a sane environment for writing excellent PHP code. Those illogical functions that many complain about, like mysql_real_escape_string and mysql_escape_string are hidden behind a database abstraction layer, so the coder never has to touch them. Sure, that doesn't make PHP better, but it makes it perfectly usable.

    Also, using a proper MVC framework (or writing one yourself) allows you to structure the code in readable and maintainable object-oriented manner, and then still use PHP as a very powerful templating language! So, you get the best of both worlds.

    1. Re:PHP is not that bad, really! by ChronoFish · · Score: 2

      Yup.

      I've been programming in PHP for 11 years - after coming from a C/C++ for 6. What I've found is that there are three types of people who despise PHP.

      1. Those who love Perl (Python, Ruby)
      PHP is too verbose and doesn't allows the same shortcuts that Perl, Python, and Ruby allow. This is viewed as a weakness of the language. Ruby is essentially a rebirth of Perl, and was a god-send for those Perl developer who found themselves "stuck" with PHP. I personally don't like implicit references or compacting code for the sake of compacting code. I much prefer to write and read code that verbose and easy to understand. And while you CAN write Perl code that is easy to read, the bulk of tends to read more like a RegEx or Awk expression.

      2. Those who love Java (C/C++)
      PHP's typelessness drives Java developers crazy. To a Java Developer OO is all about creating new data types, and locking down how those types can be passed. In PHP OO is all about begin blind to the data and not caring how the data is structured. A PHP developer would suffer under the size and restrictions of Java. Java developers hate the openness and ease of begin burned.

      3. Those who love VB / C#
      MS doesn't support PHP so there is no desire to learn it. VB/C# guys don't get why you wouldn't want to keep your OS up-to-date with the latest .net infrastructure (Sure my code is cross-platform it works on Window XP, Windows 7, and Window 8 server!). PHP guys don't know why you should have to install .Net just to get a basic app running (You mean you have to run this code on a Windows box?).

      -CF

    2. Re:PHP is not that bad, really! by Anonymous Coward · · Score: 0

      3. Those who love VB / C#
      MS doesn't support PHP so there is no desire to learn it. VB/C# guys don't get why you wouldn't want to keep your OS up-to-date with the latest .net infrastructure (Sure my code is cross-platform it works on Window XP, Windows 7, and Window 8 server!). PHP guys don't know why you should have to install .Net just to get a basic app running (You mean you have to run this code on a Windows box?).

      You're high. First, C# is more akin to Java than VB. Second, Microsoft _does_ support PHP. Grab the Web PI tool from Microsoft and PHP is right there in your face. Microsoft even provides their own PDO driver for SQL Server.

  61. Re:Recursive? No, very iterative. by Dan667 · · Score: 2

    people don't complain about things they don't care about.

  62. Re:Good things about PHP by i+kan+reed · · Score: 0

    I meant that syntax has improved in quality since C to the extent that C itself is a bare minimum of language quality.

  63. 10 years by Anonymous Coward · · Score: 0

    I'm writing an app using Linux, Apache, PostGreSQL, and PHP. Part of the reason I chose those technologies is that I believe they stand as good a chance of being around in 10 years as anything else I might have chosen. By the way, the app is replacing (and improving upon) something I wrote in 2001.

  64. Re:Good things about PHP by hazah · · Score: 1

    That lives on the server.

  65. Re:Fix? I think you mean, "migrate" by shutdown+-p+now · · Score: 1

    PHP doesn't really use standard C-style syntax, either. It pretends that it does - sometimes badly at that, like faking casts, letting you write (int), but not letting you use "int" as a keyword in any other context. But most of the rest of it is not really very C-ish.

    Any reasonably competent C/C++/Java programmer can just as well adapt to Python or Ruby after being told what the equivalent of curly braces is in those languages. If he can't, he's not a competent programmer.

  66. Re:Fix? I think you mean, "migrate" by shutdown+-p+now · · Score: 1

    wrappers for all sorts of handy stuff like POSIX threading, sockets, SSL, etc

    Which high-level language doesn't have any of these in its standard library, though?

    In fact, I'd argue that the huge problem with PHP is that it tends to wrap the underlying C APIs very thinly, exposing them practically as is, just with implicit type conversions for arguments. Which doesn't make sense at all in a high-level language.

  67. Re:Hipsters by 93+Escort+Wagon · · Score: 1

    Use ASP then, you picky bastards!

    Uh, 2000 called...

    a) They want their tech back.
    b) I did warn them about 9/11, but I don't think they believed me.

    Actually, when I first saw PHP - the first thing that struck me was how much it resembled an old Active Server Page.

    --
    #DeleteChrome
  68. Re:All Code will eventually be "Awful". Stop Whini by shutdown+-p+now · · Score: 2

    If you don't understand why Classic ASP (or rather VBScript) is awful, you're simply not qualified to judge PHP. Nonetheless, please read the article linked from my sig; it explains in details why PHP - the language itself, and its standard library - is awful on its own merits, regardless of who writes code in it and how they do that.

  69. Wow - How Stupid Of Them All by Anonymous Coward · · Score: 0

    I had no idea PHP was so bad and irrevocably broken.

    I wonder why so many people have used it and continue to do so?

    1. Re:Wow - How Stupid Of Them All by Anonymous Coward · · Score: 0

      It's free, but so is herpes.

  70. Re:Recursive? No, very iterative. by leonbloy · · Score: 5, Insightful

    Ever since programming languages existed, they have been classified in 2 categories: - Those every one bitches about, - and those nobody uses...

    Sounds clever, but it's plainly false.

    C, Java, C# are among the most used languages today. Very few serious programmers will say that they are stupid or awful. And, many criticisms aside, most programmers respect them - even love them. I program in all these languages, I like them all, and I hate PHP with passion. It's not an issue of popularity; PHP, its community, its history, all of it, is a tale of terror.

  71. Re:Good things about PHP by Anonymous Coward · · Score: 0

    In what way does it "live in the browser"?

    In the way that the GP post "doesn't know what he/she's talking about".

  72. ""PHP considered harmful" considered harmful" by Arancaytar · · Score: 1

    ...considered harmful.

  73. The GUI gum! by Tablizer · · Score: 1

    until the pace of real progress slows so much that we can actually get excited that the document viewer we're trying to port everything over to is receiving a "major" new features in HTML5 that will allow it to get a little closer to matching the desktop GUI functionality of twenty years ago, only not as well and with the added requirement of several orders of magnitude more hardware power required to keep it going.

    Perhaps a lot of the problem is that we are putting too much of a burden on our app languages because we are trying to stretch the HTML stack beyond what it is suited for, user-interface-wise.

    I suggest a new "GUI Browser" (or pluggin) be created that handles desktop-like GUI's well so that we don't have to hand code every keystroke and mouse-stroke. About 90% of all GUI actions are predictable enough to be made into a declarative language (perhaps a markup language) so that we shouldn't have to micro-manage so much in our app code.

    We've given the HTML stack 15 years to match desktop-like needs, and it fails and fails again, creating jittery, vendor-sensitive, and crashy crap. HTML5 is only an incremental step. The GUI Browser would be a single code-base for all vendors, sort of like Flash/Java-Applets Done Right.

  74. Re:Fix? I think you mean, "migrate" by ewieling · · Score: 1

    I sort of like that. When the PHP docs fail me I can turn to my C and Unix books for documentation on these wrapped functions. However, I can see how many people would not like that.

    --
    I really shouldn't have used someone else's email address for this account.
  75. "1" == "true" by slick_rick · · Score: 2

    Or at least it does in PHP 5.2, but in 5.3, not so much. There have been many of these little idiosyncrasies over the years, enough that my company moved our core product to Java long ago. Stupid stuff like that makes it impossible to upgrade the PHP version without major QA and developer time to address all the new "fixes" the PHP folks decided to introduce in the latest minor release. Meanwhile, my C and Java code from 2001 still runs just fine. That said, when I am coding something for fun, not for profit, I usually end up with PHP on the server side. PHP is coded by amateurs for amateurs. Keep it far and away from any critical systems and it can actually be kinda fun.

    --
    apt-get install redhat please god - Me (take it easy, I love Debian)
    1. Re:"1" == "true" by dmgxmichael · · Score: 1

      That word "amateur". It does not mean what you think it means.

    2. Re:"1" == "true" by Anonymous Coward · · Score: 0

      Except that's not an idiosyncrasy. Read the documentation.

  76. Re:Fix? I think you mean, "migrate" by shutdown+-p+now · · Score: 1

    I guess the question at that point is, why not just write in C? You don't really gain a lot of convenience from PHP, but you lose considerable performance (IIRC, the only "scripting" language slower than PHP was Ruby, and even then only until 1.9).

  77. why you no stop bitching? by Anonymous Coward · · Score: 0

    I don't know what all the bitching is about php works well enough for me and im a shitty programmer (imo), but whatever my problem with php is I get around by using another methodology, mostly javascript or ajax

  78. Re:Good things about PHP by Ignacio · · Score: 1

    It didn't help that the original K&R writing style was quite poor

    That's because they never intended for it to be used for anything other than UNIX. Ain't their fault everyone else said "CAN HAZ PROGRAMMING LANGUAGE?".

  79. Solution #47 by Tablizer · · Score: 1

    * Create new language that has C-like syntax. (If you don't want C-like syntax, you'd probably be using Python or Ruby instead anyhow.)

    * Borrow the good and neutral stuff from Php, overhaul the ugly parts.

    * Make sure it includes "web-friendly" string handling, something that JavaScript lacks.

    * Simplify the type system, or perhaps toss a hidden type flag (marker) altogether, using situational typing instead.

    * Merge associative arrays and objects. They are too similar in a dynamic language to make different "kinds" of things. Allow both dot syntax and square bracket syntax for indexing, like ColdFusion does, because each works better in diff situations.

    * Make a better Switch/case statement, perhaps allowing the old-style also for C familiarity.

  80. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 0

    "PHP, its community, its history, all of it, is a tale of terror."

    Not if you know what you're doing. The fact that you listed C and Java, C# together speaks volumes.

  81. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 1

    C, Java, C# are among the most used languages today. Very few serious programmers will say that they are stupid or awful.

    C - correct, not many people bitch about it nowadays. That's probably because it has changed only incrementally from what Ritchie and Thompson first came up with. The big OOP extension project in Bell Labs turned into C++.

    Java - everybody bitches about Java. The language is no longer simple, the libraries are sprawling, class loading is complex and error prone, client side applications are slow and difficult to develop, enterprise frameworks are fragmented into various camps because of design errors by Sun. Et cetera.

    C# - people called it a Java clone, which it pretty much was originally. Like Java, it results in sluggish load times from client apps. And it only has adequate commercial support on Windows.

  82. Shebangs on Windows by tepples · · Score: 1

    What you say works well in a UNIX-like environment. Windows, on the other hand, doesn't see #! lines; instead, it looks in a registry that maps the end of a filename to an application. It took until Python 3.3 for PEP 397 launcher to get implemented and added to Python.

  83. Re:Recursive? No, very iterative. by Reality+Master+101 · · Score: 4, Insightful

    Very few serious programmers will say that they are stupid or awful.

    Huh? Have you just fallen off the turnip truck?

    C: Unsafe at any speed. Un-bound-checked array, null pointers, etc, etc. Many people HATE C because it's unsafe, though they grudgingly admit that it's sometimes a necessary evil for system programming.

    C++: Overly complex, insane learning curve, no garbage collection. There are no shortage of people who hate C++.

    And Java is possibly your most absurd point. Overly verbose to the extreme, slow, insane memory requirements, slow, crazy libraries, and slow (please don't bother to claim that isn't slow).

    --
    Sometimes it's best to just let stupid people be stupid.
  84. Re:Recursive? No, very iterative. by marcosdumay · · Score: 1

    And then, there is PHP, that nobody even care to bitch about anymore, since it's so bad everybody agrees on how bad it is... But everybody still uses.

    It is not completely new, it is just one entire new level on the game.

  85. The hammer analogy is a bad one by thievery1017 · · Score: 1

    It's not that a PHP developer sees the double forked hammer and a normal hammer sitting side by side, ready to use to get those 3-nails in, and foolishly chooses the double forked one. It's that the normal hammer in question will take forever to configure before you can start using it, you have to read a complex set of instructions to learn how to use it, and then if you don't use it perfectly the right way, it won't work at all. I agree with most of the article author's points... and hell, go ahead, build a better language that keeps in mind the reasons PHP is still so popular... but if you summarize your whole argument with a flawed analogy, then maybe you won't ever quite hit the nail on the head. Granted, maybe I took my analogy into flawed land... Analogies are hard.

  86. Re:Cheap web hosting with SSL and non-PHP? by tepples · · Score: 2

    Then allow me to rephrase it in a non-spam way: People use PHP because hosting with PHP is cheaper than hosting with languages other than PHP.

  87. PHP - python by Garble+Snarky · · Score: 2

    I've been using PHP for years, and not two days ago I decided it's probably worth learning python and switching to that for server-side scripts. I got a python cgi script working in about 10 minutes. Then, I just wanted to be able to run python scripts from arbitrary locations on my site. Looking into that, I could not find a single explanation or tutorial website to help me out. Is that just not how python works? Can anyone point me to some resources that will help an amateur familiar with PHP, learn to completely replace PHP with python, on a commercially hosted webserver?

    1. Re:PHP - python by Anonymous Coward · · Score: 0

      search for mod_python. There's a tutorial.

    2. Re:PHP - python by Anonymous Coward · · Score: 0

      Depending on what you mean by " arbitrary locations on my site" you likely don't want to do that.

      But if you just want to run Python scripts that are located at different places, you need to add the directories containing them to the Python Path.

    3. Re:PHP - python by yeltski · · Score: 1

      I understand how you feel right now, I was in the same spot some years ago. What you are used to, is that your file system tree is your navigational tree. Yes, you can keep doing that, having your web server execute various .py files in your filesystem, and import your common modules. However, the reason this is not common in python, is because it's actually not the optimal way to have your address/navigation work. There is no reason your code files need to be arranged according to your navigation. What is standard in python, is what Drupal and almost all php CMSs do, that is, you have a single application, and it parses and handles the URI as it pleases. What I would recommend, is start with this: http://webpy.org/ it is very easy to install. If you have a complicated app, you should try Django framework. Another thing about python, you are not expected to be writing your website from scratch, as you'd be recreating a lot of crud written many times over already.

    4. Re:PHP - python by Garble+Snarky · · Score: 1

      Thanks, that's exactly the kind of response I was hoping to get.

  88. Re:Fix? I think you mean, "migrate" by ewieling · · Score: 3, Insightful

    I hate pointers in C, the lack of regular expressions in C, and string handling in C. I think of PHP as "like C without all the stuff I hate about C". I'm sure language purists will be astonished by that statement. I realize PHP isn't fast, but it seems to be fast enough for the stuff we use it for.

    --
    I really shouldn't have used someone else's email address for this account.
  89. Re:Fix? I think you mean, "migrate" by steveb3210 · · Score: 1

    It sounds more like you're used to what you're used to and don't want to change. Meanwhile thoose "overexcited college grads" don't want to be weighed down by the 20 years of trash thats part of the PHP code base... I'm a PHP dev now, and was a rails dev for 5 years - I'll take ruby/rails any day.

  90. Re:Hipsters by marcosdumay · · Score: 1

    They want it back? Really?!?

    If PHP resembles ASP, it is because PHP is a plain copy of ASP. With a few small points that needed extending extended, and a few small points that needed correcting made worse.

    The only problem is that it came 5 years later, when ASP wasn't really needed anymore.

  91. Some refs are wrong by GPLHost-Thomas · · Score: 1
    https://maurus.net/resources/programming-languages/php/ says:

    Instead, to do the same thing you now have to write: return $var = &new ProtectedClass();

    This, in PHP 5.3 would do "Return new as reference is deprecated". This would crash in PHP 5.4 IIRC.

    Now, on that same page, I'm seeing a pattern of people doing the usual rant about the === thing, but this goes absolutely nowhere. It's equally stupid to write == in C in an if statement, but nobody is complaining about it. The rest of the argumentation is crap too. I just don't buy into such silly rants.

  92. If PHP is broken, then what is Java? by Anonymous Coward · · Score: 2, Interesting

    PHP is a garden of paradise compared to Java, which has three or four thread models (Android has another couple), at least four layers of I/O (original streams, better streams, and two NIOs), multiple GUIs (AWT, Swing, and all the third pary stuff which fixes Swing's glaring deficiencies that make it useless), and so on. Not to mention the steaming pile of web overengineering which includes JSP, JSTL, EL, and so on as part of J2EE, plus all the third party stuff like Struts and Hibernate. Struts has two incompatible versions (one works with Java Faces, which is like an overengineered JSP) and Hibernate changes all the time. If you like MVC, I have lost count of the MVCs available. If you just want to overengineer for the heck of it, you can use Spring AND Hibernate at the same time. It's like wearing a belt AND suspenders.

    Compared to this, PHP is a sane and rational alternative for web developers.

  93. Re:Good things about PHP by hey · · Score: 1

    Oops I meant server not browser.

  94. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 0

    To be fair, he said C#, not C++

  95. Re:Fix? I think you mean, "migrate" by Just+Some+Guy · · Score: 1

    Closures this, aspects that, ooh look ma I'm using list operators... academic functionality makes for cute sample code, but those of us with actual jobs have more pressing things to do than learn a new language and syntax.

    Fortunately, the "closures this, aspects that, list operators!" group makes a ridiculous amount of money cleaning up the mistakes and horrible non-engineering of the people who "just want to get things done".

    --
    Dewey, what part of this looks like authorities should be involved?
  96. Re:Recursive? No, very iterative. by Reality+Master+101 · · Score: 1

    Oops, you are correct. My apologies to the original poster. But then, C# is Microsoft, so I think it's fair to say that you can find programmers out there that say it's stupid and awful. :) [I actually haven't used the language to a significant enough extent to have an opinion]

    --
    Sometimes it's best to just let stupid people be stupid.
  97. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 0

    Sure we do, but I wouldn't call it bitching, more 'giving suggestions and positive criticism' , ok well , with occasional bitching :-)

    People dislike what they use, because they always look for something better ( it's human nature )

    That's why things keep improving, because the community demands it.
    If no one is complaining about your software, you have no idea what to improve.

    You say you like Java : Java is a good example of how community process improved something which was really awful to code in and dreadfully slow , into something which is literally used everywhere ( I love Java btw ) .

    PHP has it's uses : it's very lightweight , and very fast , and as such , ideal for many basic sites.
    Not to mention the price tag in comparison to J2EE.

  98. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 0

    Java is as fast as C (or nearly as fast) for most tasks. Java is indeed slow on the desktop and for graphics in general (compared to native code), however, this is not generally where Java is used.

    Saying Java is slow in general (and saying it repeatedly) only serves to show your ignorance in this context.

    So yes, I will claim that Java is not slow (despite your protestation not to do so), and furthermore, I will claim that you have no clue what you are talking about.

  99. Lets face it by gobanjoboy · · Score: 1

    This isn't really about PHP sucking. It's scripting languages vs non scripting languages. For some reason people feel less manly if all the can do is script. Programming is programming. No one is forcing anyone to write crappy PHP code. PHP does not have to be written like an old ASP page where you hope in and out of PHP tags. Modernize how you code PHP all you like. I started out with Perl->PHP->C#->C++. When I am coding in PHP I can replicate practices learned and use in other languages. Choose the tool that suits the task. There is no one answer for everything.

  100. grow up by Tom · · Score: 1

    Language wars are so 20th century. Can we grow up? The perceived differences between languages are much larger than the real ones, and the quality of the programmer and the programming methodology and environment are ten times more important than the choosen language.

    Great software is written in every language, just like crap software is written in every language. Get over it.

    I personally happen to like PHP, but if you want to use Python or Ruby or Java or Brainfuck, then I don't care. Whatever works for you.

    --
    Assorted stuff I do sometimes: Lemuria.org
  101. Re:Recursive? No, very iterative. by Reality+Master+101 · · Score: 1

    Java can nearly as fast as C for very small pieces of code where the runtime can do straightforward JIT compilation, that is true. If you define that as "where Java is used", then your claim is true. However, for code of any size or complexity, Java slows down tremendously. Why do you think Java is "slow on the desktop"? It's because desktop apps are applications of size and aren't trivial pieces of glue code.

    Or, to put it another way, if Java isn't inherently slow and is "as fast as C" as you claim, why would there be an exception around desktop apps or "graphics in general"?

    --
    Sometimes it's best to just let stupid people be stupid.
  102. Re:Cheap web hosting with SSL and non-PHP? by codepunk · · Score: 1

    If you are paying 5.95 per month for hosting I am sure it is worth every cent.

    --


    Got Code?
  103. Re:Recursive? No, very iterative. by hobarrera · · Score: 4, Funny

    C is so awful that nowbody would dare use it for any serious stuff, like kernels or drivers!!!

  104. Yadda Yadda giberish by el_jake · · Score: 1

    What works ain't broken. What is broke doesn't work. Nuff said move along rant at something else.

    --
    In order to form an immaculate member of a flock of sheep one must, above all, be a sheep.
  105. Cash money, my friends. by sochdot · · Score: 1

    There is a very simple reason that I still use PHP quite a lot: there's a thriving market for it. If you are a good, responsible coder who knows how to navigate the pitfalls of PHP, people will pay you, and pay you well, to do it. Feel free to complain that PHP is a messy, crappy language; I'll agree with you all the way to the bank.

    --
    If at first you don't succeed, destroy all evidence that you tried.
  106. PHP is excellent by Anonymous Coward · · Score: 0

    for certain jobs.

    It is great to mock up use cases for testing or producing engineering code.

    It is great for reverse engineering certain functionality to see what works and then use that to provide the basis of a formal functional specification.

    No need to worry too much about connectivity and services as it mostly works, perhaps not as low level for key tasks but close enough.

    It offers raft of flexibility in a fairly robust, performant, scaleable, cross platform way and lets you experiment.

    All in all I believe it meets and exceeds its objectives with a high degree of quality.

    I have to say I rate PHP highly in many areas and above all it just kinda feels nice.

  107. What about Perl? by bk2204 · · Score: 1

    Perl definitely has a C-like syntax. It was the first language I learned after C and C++.

  108. Re:Recursive? No, very iterative. by fredrik70 · · Score: 1

    C# got lots of goodies,especially if you come from dynamically typed and functional languages. Shame it only officially runs on windows. I wish MS embraced or at least blessed mono properly.
    c# got stuff like anonymous functions/classes/lambdas/expressions trees/type inference/ and oter things I that I missed. Yes maybe java is a more enterprise and solid langauge, but c# is quite exiting.

    If only they stopped insisting on having capitals at te beginning of eac method, arhh..

    --
    if (!signature) { throw std::runtime_error("No sig!"); }
  109. Re:Cheap web hosting with SSL and non-PHP? by tepples · · Score: 1

    I'm told someone who wants to be hired as a web developer needs a portfolio of web applications that hiring managers can play with. How much should a job seeker expect to have to pay to host his portfolio site?

  110. You show only your own ignorance by rubypossum · · Score: 2
    It's a question of chance and marketing that you picked python. You show your own ignorance that you lump Ruby in with Perl. Ruby is syntactically and culturally only as related to Perl as Python is, or less. Modern ruby is the cleanest, most elegant, expressive and fastest of the big 4. It offers a bigger standard library (gems(40,000) vs pypi (1,022)), a wider selection of interpreters and platforms, not to mention much better documentation and educational resources.

    Ruby is used by a wider group of people and in a wider area than it ever has been. Also, there's a lot of other really great languages out there you should consider before you idolize one language as perfect. Erlang and Haskell are amazing and certainly worth checking out. Not to mention node and the javascript revolutionaries. A lot of people get stuck on their first language I encourage you to branch out and try Ruby at least. You'll find a much different language than you seem to think. I personally had the following progression in my love affairs with languages:
    1. AMOS Basic
    2. Lattice C
    3. Perl
    4. PHP
    5. Python
    6. Ruby
    7. Erlang
    --
    I have a theory that the truth is never told during the nine-to-five hours. - Hunter S. Thompson
    1. Re:You show only your own ignorance by Eponymous+Hero · · Score: 1

      A lot of people get stuck on their first language

      i think this is where a lot of php hatred comes from, especially those who whine about dynamic types. they just can't figure it out. i hear complaints about the string functions. yeah the names are inconsistent. get over it.

      --
      insensitive clod overlords obligatory xkcd car analogy russian reversals whoosh pedant fanbois ftfy in 3...2...1..PROFIT
  111. Very appropriate username by rubypossum · · Score: 1

    Thank you sir, that was exactly what I was thinking.

    I would say that Java is the worst though. I can't count the number of programmers and managers who have to deal with it's terminal bitchiness every day. You didn't even mention all the security vulnerabilities that have caused it to be disabled by default on so many of our corporate customer's machines these days.

    Java == Unreliable insecure miserably unproductive busy work.

    --
    I have a theory that the truth is never told during the nine-to-five hours. - Hunter S. Thompson
  112. SOMEONE EXPLAIN THE ISSUE TO ME! by uslurper · · Score: 1

    No where in the original article or the high scored posts does anyone actually say what is wrong with PHP.
    Saying PHP is like a double-clawed hammer doesnt mean anything. I would much more equate it to a normal hammer or hand tool. Other languages like Java or C++ have seemed more like a router: they can do a wide variety of things but you need an assortment of bits, templates, and jigs for any basic chore.

    I have used PHP and I dont see what the complaint is. It provides specific functionality and is supported on many servers.
    It works and it is easy to use. Is it the syntax? The performance? The reliability? What?
    I HAVE MOD POINTS! POINT ME TO SOMETHING GOOD AND I WILL MOD IT UP!

    --
    oldhack: "Security is a waste of money until shit hits the fan. 5 minutes later, it becomes waste of money again. "
    1. Re:SOMEONE EXPLAIN THE ISSUE TO ME! by narcc · · Score: 1

      I have used PHP and I dont see what the complaint is. It provides specific functionality and is supported on many servers.
      It works and it is easy to use.

      That's where you've gone wrong, people hate PHP because it's easy to use. I mean, we can't let just anyone write software! High-level languages should be as complicated as possible to discourage the have-nots!

      Seriously, I truly believe that this is at the root of the PHP hate. It's the same reason that VB got bashed -- it let any idiot easily hack together an app, and any idiot did. Maintaining some inexperienced developers VB code was painful, and they blamed the language for daring to let non-experts write code. Nevermind that *they* got their start in BASIC on the C64 their parent's living room back in the 80's (a simple language that let them get up and running quickly). They're "professionals" now, and only professionals should be allowed to write code! (Hey, they wrote a FactoryFactoryFactory last week, after all. That's what experts do!)

      There are legitimate gripes about the language, but I don't know of a single language that you can't complain about endlessly. It's "cool" to hate on PHP right now, however, so that's what the rock-star level super-programmers do -- they follow the latest fad blindly.

    2. Re:SOMEONE EXPLAIN THE ISSUE TO ME! by Anonymous Coward · · Score: 0

      Classic post and so true.

  113. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 0

    Firstly, apologies for calling you ignorant / clueless in my previous post. it was unnecessary and uncalled for, I was overreacting to your comments.

    In regards to your above comments, I would tend to disagree and perhaps claim the opposite (but the situation really depends).

    With JIT, Java can often be nearly as fast as some small C programs (sometimes even faster), but equally likely, a highly optimized C program can beat Java for number crunching in specific domains (linear algebra for one, I believe, but don't quote me).

    For complex programs, a well written Java program will often have better performance than a C program (assuming similar development times) since Java can be coded cleaner / faster and the micro gains you could realize in a C program are less prevalent. When you extend this to complex multi-threaded programs then I would expect a Java program to be both much more robust and better performing (as well as far easier to code) since multi-threading in Java is very well implemented.

    This is why, for instance, you see a lot of large e-commerce sites written in Java, but few are written in C (although there are some examples of specific parts being written in C, such as messaging queues).

    The reason Java does so poorly on the desktop is that there is a significant initial load time for any Java program as it loads the JVM and all of the classes, as well as an increased memory footprint due to the JVM (as well as the fact that a Java program would generally use more memory than a comparable C program).

    In regards to graphics, the issue in Java is that you are necessarily going through an abstraction layer and not working with the OS or hardware libraries directly. This results in inefficiencies and poor graphical performance.

    Overall, the point I would like to make is that the notion of Java being generally slow is outdated and not true. Java does have issues on the desktop, for the mentioned reasons, so I would never recommend it for that purpose, but this is not really due to the execution speed of the JVM or the language itself.

  114. Choose Ruby! by rubypossum · · Score: 0, Offtopic

    Modern ruby is the cleanest, most elegant, expressive and fastest of the big 4. It offers a bigger standard library (gems(40,000) vs cpan (25,000) vs pypi (1,022)), a wider selection of interpreters and platforms (IronRuby, JRuby, Rubinius,Cardinal, etc), not to mention much better documentation and educational resources.

    Ruby is used by a wider group of people and in a wider area than it ever has been. Also, there's a lot of other really great languages out there you should consider before you idolize one language as perfect. Erlang and Haskell are amazing and certainly worth checking out. Not to mention node and the javascript revolutionaries (which some people abhor.) A lot of people get stuck on their first language I encourage you to branch out and try Ruby at least. You'll find a much different language than you seem to think.

    --
    I have a theory that the truth is never told during the nine-to-five hours. - Hunter S. Thompson
  115. NZS - Not Zend's Shit by Anonymous Coward · · Score: 0

    Take a page from the Not Matt's Shit people.

  116. Perhaps the Core is the problem by Anonymous Coward · · Score: 0

    The general excuse is there are too few maintainers. Perhaps the true problem isn't that too few people want to contribute, but rather the core team needs to be replaced.

  117. Pliers? by Anonymous Coward · · Score: 0

    You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever.

    Get your tool analogies right: If you are using pliers to turn bolts you are doing it wrong.

  118. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 0

    C++: Overly complex, insane learning curve, no garbage collection. There are no shortage of people who hate C++.

    So they added garbage collection, and everybody hated managed C++. In fact, I never heard a competent C++ programmer complain about the lack of garbage collection. Everyone I know is happy with smart pointers as a means of managing memory. When you use C++ you do it because you need/like control over these things.

  119. Java Not Realtime Capable by frankgerlach11 · · Score: 1

    Real Java programs freeze occasionally for a second or more to perform garbage collection. That simply kills user experience and makes people hate a program. That is why high-quality software cannot be made using Java (or equivalent systems like .Net).

    1. Re:Java Not Realtime Capable by Reality+Master+101 · · Score: 1

      To be fair, Minecraft is a (surprisingly) quality program that is written in Java. It's also a total memory pig and is much slower than other 3D games, though also to be fair, it's a quite complex 3D environment (infinitely changeable), so it's hard to compare to games with more static worlds. But it does show that it's at least possible to write a good game in Java. It does occasionally freeze up, however, probably doing garbage collection to my son's infinite annoyance. :)

      Now, a fair comparison is comparing the Java version of the Scratch environment to the Flash version, and the Flash version is about 5-10x the speed.

      --
      Sometimes it's best to just let stupid people be stupid.
  120. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 0

    Very few serious programmers will say that they are stupid or awful.

    Huh? Have you just fallen off the turnip truck?

    C: Unsafe at any speed. Un-bound-checked array, null pointers, etc, etc. Many people HATE C because it's unsafe, though they grudgingly admit that it's sometimes a necessary evil for system programming.

    C++: Overly complex, insane learning curve, no garbage collection. There are no shortage of people who hate C++.

    And Java is possibly your most absurd point. Overly verbose to the extreme, slow, insane memory requirements, slow, crazy libraries, and slow (please don't bother to claim that isn't slow).

    And what do you suggest, Ruby? That is what serious programmers use right?

    I mean, it kinda seems more like you are the dipshit.

  121. Re:Recursive? No, very iterative. by Greyfox · · Score: 1
    C certainly is bad in the hands of a bad programmer, but no language is particularly good in that case. I was reflecting today as I was helping a co-worker debug 18 ruby validation functions that had all been cut and pasted from the same one and which all had the same bug in them, that some people really should just not be programming. And we really shouldn't be making it any easier for those people to program.

    C++ really isn't that bad once you understand pass-by rules and where stuff is allocated. And it's really, really type safe. Probably as type safe as ADA was back in the day. Being a compiled language greatly limits the types of errors you're likely to encounter at run time, and cppunit so far has been one of the nicer unit testing frameworks that I've had to work with. Boost is moderately usable these days, though I still find myself wishing that some of their libraries were better documented. I'd still rather roll my own socket server, but that's actually kind of true of Java as well.

    Java's mostly fallen from my favor because its versioning problems seem to be almost as bad as Ruby's (And that's pretty damn bad.) That's mostly if you're working on an Apple machine. You can manually work around at least some of the problems on an Apple, but that's already defeating the main selling point of the language. Admittedly I've had to deal with it on some fairly esoteric platforms, but its primary selling point was "write once run everywhere," which it fails at. Plus Oracle's recent behavior has me wary of all of their products now. Like I needed another excuse. I do like the design of Java mostly, though I really do miss destructors when I'm working with it. The implementation just puts me off.

    You haven't really lived until you've had to support a project that requires two libraries which require two different versions of ruby to work.

    --

    I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

  122. Re:Recursive? No, very iterative. by multicoregeneral · · Score: 1

    Java, on it's own really sucks. It's painful and counter-intuitive to write in. Output is slower than dirt, and you have to compile it before you even know if your code works. Even then, you're really only guessing at it. For web applications... it's okay for web services, but I wouldn't use it for the kind of stuff that php does well, like content management. I've been there, done that, salvaged the wreckage. Groovy seems pretty cool though.

    --
    This signature intentionally left blank.
  123. Re:Recursive? No, very iterative. by Reality+Master+101 · · Score: 1

    I was making the arguments that others make to dislike the languages, not my personal feelings. There's no such thing as a perfect language. The arguments against Ruby (as I understand them, I haven't used the language all that much) is that it's very slow and the community is full of asshats.

    --
    Sometimes it's best to just let stupid people be stupid.
  124. Re:Fix? I think you mean, "migrate" by billcopc · · Score: 1

    In what kind of rosy-tinted world do you live, where budgets are allocated for "nice to have" stuff like clean code and proper docs ? To a non-programmer, if the stupid thing works most of the time, it's done. That means you take the little prototype you demoed at last tuesday's meeting, slap the corporate logo on there and bite your tongue because the PHBs aren't going to give you another 3 months to rewrite the whole thing as a cleanly designed, production-ready app. Sure, my own pet projects undergo continual refinement, because I take pride in my work, but when I'm on someone else's dime, all those good intentions fly out the window and the only question coming from management is "when can we invoice the client", not "is everything up to your O.C.D. standards".

    Sorry but that's just the reality of capitalism. It's not about doing things right, it's about selling crap to idiots.

    --
    -Billco, Fnarg.com
  125. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 0

    I am writing music notation software in pure Java 4.2. I tested it on my old G4 Mac 867 Mhz. My code can highlight and playback 32nd notes at fast tempo, displaying an animated anti-aliased score. Java is not slow if you don't create too many short-lived objects so the garbage collector does not pause your program for too long. There is never a pause in playback. Verbose? Objects and their content must be clearly defined; this helps the programmer understand the "interface" and the code layout. Less comments are required. Java FX alleviates the need for verbose code. Yes, Java runtime takes more memory than a native program but not a crazy amount.

  126. But it's PHP! by raehl · · Score: 1

    The whole POINT of PHP is that it works DESPITE bad coding practices.

    If the programmer were capable of GOOD programming practices, they'd be using Python!

    1. Re:But it's PHP! by Miamicanes · · Score: 2

      The big problem with PHP is that you can get yourself into situations where trying to handle error conditions can actually make things worse than just letting it crash, burn, and try to clean up its own mess for you. Let's start with the fact that try/catch DOESN'T actually work with php_mysqli and pile things onto the "things that suck about PHP" list from there.

        I borked an entire database table once thanks to PHP's willingness to recast just about anything, even when recasting contradicts the prepared statement declaration command in php_mysqli itself. The ONLY thing stopping me from porting the whole app to Java is the fact that I can't figure out how to get Tomcat to not accept incoming http connections or respond AT ALL until it's 100% ready to deal with requests, instead of crapping out and returning semi-random 500 errors for that period of 20-90 seconds when it's in an "indeterminate" and "undefined" state while starting up.

  127. Re:Recursive? No, very iterative. by cerberusti · · Score: 1

    If "most tasks" means reading some XML document or HTTP post and writing it to a DB... then yes, Java is about as fast as C.

    This is probably what most people who write software for a living do, so it works. I should also mention that pretty much any language works here, they are all fast enough for this (some differences, but close enough that it just does not matter.)

    If you are talking about a program that does some simple CPU calculation like listing prime numbers, it will also be somewhat close (although a decent C implementation should be slightly faster.)

    If you are talking about something more complex, this is not so true. There are types of solutions that are simply not available to you in a language which does not allow you to manage the layout of your address space. It becomes more important when your address space is much larger than physical memory, such as a modern 64-bit program (not that current implementations actually give you 64-bits of address space), or a 32-bit program from the era where 64MB of memory was normal.

    For the quick example:

    If you have a task that has a large but limited number of possible results (enough to more than fill physical memory) the obvious choice is to make a list, and if you need to add or update a result you look it up (which means you either crawl the list, or you sort it and search it.)

    This is nearly optimal in Java, or pretty much any language which manages memory for you.

    There is a better (as in far faster) solution available in C though. You can allocate enough space for all possible results and calculate the index of the result you want. All pages (a 4k block of memory corresponding to a Page Table Entry... which is basically hardware memory managment) end up being noted as zero filled and no physical memory is actually allocated until you write a value to that page (you do not use malloc() for this, you use the operating system allocation functions.)

    Why is this so much faster?

    Because it completely avoids all of that time intensive sorting and searching (or list crawling.)

    The C lookup is a very quick calculation that probably involves numbers which already reside in a register (or at least some level of the CPU cache.)

    The Java lookup requires that you read from memory enough to do a binary search on each list (not to mention when you add to it and need to resort the list... even fast insertions in a sorted list are not that quick.)

    The C version will usually use less physical memory as well (not assured as there is a pathological case where one value on each page is updated.)

    In a complex enough program, this can easily lead to a run time which is several orders of magnitude lower than the Java version.

    You may contest by saying the Java version is not performing 10,000 times as many operations, so how can it be so much slower?

    The answer here is that CPU speed has very little to do with how quickly most programs execute these days. It is almost always memory bandwidth or latency that will be your limiting factor.

    The calculation involving a couple of numbers already in a register is extremely fast, the random reads from main memory are not. In needing to transfer more from memory for the lookup, you are also competing with the information the program really does need to read from memory (and any overhead the JVM imposes.)

    There are many other things which you can do in C but cannot do in Java, but this is one of the easier to understand ones.

    In short, if you write the same program in C and Java, they will be somewhat close in speed. You can however frequently write a C program that is much faster, produces the same results, and is not possible to write in Java.

    Removing control of memory from the programmer restricts the solutions which are available to you quite a bit.

    I should also note that managing memory is not really all that much of a burden. If 10% of your code is memory management, you probably botched it badly.

    --
    I'm a signature virus. Please copy me to your signature so I can replicate.
  128. Re:Recursive? No, very iterative. by cerberusti · · Score: 1

    None of those languages are stupid or awful, they all have their place.

    C: Any even reasonably decent compiler will bounds check for you if you ask it to, there is simply no point outside of a debug build in most cases.

    All of the errors you mentioned are an error in any language. Reading or writing past the end of an array is as much an error in Java as in C, not initializing a variable is an error in both Java and C (the NULL pointer.) You can trap the page fault in C if you want and pretty much give the exact same result anyway, but a crash is a crash. It does not matter to your user if it is the operating system noting an access violation on some memory, or a Java program encountering an exception that it cannot recover from.

    C++: Yes it includes everything (you want kitchen sinks?... what color?) I will admit though, I recently was very glad that TR1 regex exists in C++, it saved me from having to write that program in Perl (in true C++ style, it even offers you the choice of any popular regex syntax.)

    Mostly people who primarily write C++ do not use the entire thing, many basically are writing C with just a few extra features in use.

    Java: Significant defense against a bad programmer (part of why it is so verbose.) It is a godsend for large projects where you may have many programmers of unknown quality.

    If you turn a new (or simply bad) programmer loose in your large complex Java code base for a few weeks they will be unproductive.
    If you turn a new (or simply bad) programmer loose in your large complex C++ code base for a few weeks... I hope you have backups.

    --
    I'm a signature virus. Please copy me to your signature so I can replicate.
  129. Re:Recursive? No, very iterative. by Isaac+Remuant · · Score: 1

    You'll find a lot of people who don't really use c, c++, c# or java who will demolish each of those languages for different and somewhat cliche reasons.

    That said, from those who actually use the language, you're bound to find less absolute hate and more specific complains about problems that are solved in "easier ways" with other languages.

    --
    "Science can amuse and fascinate us all, but it is engineering that changes the world. " - Asimov.
  130. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 0

    C: Unsafe at any speed. Un-bound-checked array, null pointers, etc, etc. Many people HATE C because it's unsafe, though they grudgingly admit that it's sometimes a necessary evil for system programming.

    Null pointers are a reality in many modern'ish languages: C#, Java, etc. Granted, they're nowhere near as unforgiving as C/C++. The big difference is that these days a competent C coder is expected to know a bit more about the underlying gotchas and security considerations of the language than ever before. It ends up working out since it weeds out the web guys. It's more than simply knowing C, it's *knowing* C. The same can't be said. and doesn't have to be said, for the rent-a-coder slinging C# or Java.

    C++: Overly complex, insane learning curve, no garbage collection. There are no shortage of people who hate C++.

    The learning curve is hardly insane but it does exist, anyway you say it like it's a bad thing. Again, it helps to weed out the casual coders. As for no garbage collection, wtf? Conscientious manual memory management, smart pointers, accepted idioms and best practices (e.g. raii), and a strong grasp of the language are sufficient. I understand that formal garbage collection is on the horizon, but it will be opt-in and is only intended for the very few edge cases in which it's truly useful. Interestingly C++ wasn't mentioned in the comment you to which you've replied. C# was and yet is curiously absent in your criticisms.

    As for Java....no comment. Same for C$.

  131. Re:Recursive? No, very iterative. by doublebackslash · · Score: 1

    Okay, instead lettuce discus alternatives

    What is faster but still includes strict ahead of time (dancing around the word compile time, since a JIT can eat source about as well as some intermediate format) type-saftey, GC, safe arrays (or, better, collections of some sort), and is object oriented? I've not done colmparative research but I'd immagine something like C# might fit the bill, but considering that I don't develop on Windows I suspect be subject to a less polished runtime environment. I don't expect python would be faster, but I'm open to suprises.

    Last, if it helps, I wasn't taught Java in college. Heck, it is the first OO language I learned (self taught) and I went years thinking it was the scum of the Earth. Turns out that I found some good stuff there. Heck of a lot faster than perl and easier to code up solutions to Project Euler problems in. Missed some tricks from C, but once I learned how to properly program in an object oriented fassion things got a lot easier. Just don't want you to think I'm a Java zealot.

    --
    md5sum /boot/vmlinuz
    d41d8cd98f00b204e9800998ecf8427e /boot/vmlinuz
  132. Re:Recursive? No, very iterative. by VortexCortex · · Score: 1

    Every fault you mentioned comes with a valuable tradeoff. PHP's tradeoff for its faulty design is that it gets morons programming faster... This is only beneficial if you twist that word along the ridiculous dimension.

  133. Re:Recursive? No, very iterative. by lilrobbie · · Score: 1

    Heh. Anyone complaining about C# is likely complaining about something other than the language (e.g., politics, patents or CLI). The language itself is very expressive... I'm from a Java/C background, and find C# allows me to be much more expressive (almost to the same level as python and related) while still retaining absolutely awesome type-safety.

  134. Re:Fix? I think you mean, "migrate" by narcc · · Score: 1

    Closures are best avoided. They're not well understood (even by professionals), they're hard to read and understand, and (while occasionally handy) have extraordinarily limited use.

    Of course, closures are the new hot thing right now so they're misused all over the damn place! I've even heard morons say that they can't imagine developing without them. Odd, as they got along just fine before they discovered them!

    There have been a few times when I've been tempted to use closures. In every case it was because I had made a stupid design decision. A bit of extra thought and a bit of re-factoring and cleaner, faster, easier-to-maintain code was the result.

    That is to say, in my experience, closures are a "code smell". If you see a place they may be convenient, stop immediately and re-think what you're doing!

    That they're poorly understood is the only real reason closures and the whole "multi-paradigm" language fad has gained so much traction. If this discussion is any indication, developers HATE anything that's easy to use and they HATE that newbies write bad code. (Hint: they'll write bad code in any language, they're new to it!)

    When I was 10 or 11 I was very nervous about letting people see my code. Why? If they saw how easy this programming thing was, then they wouldn't think I was smart or special in any way. I grew out of it, but it doesn't look like a lot of developers here have.

    They WANT complexity. They don't want tools that are easy to use -- then they wouldn't be special! They love writing cryptic code that's difficult to understand. After all, they understand it, so that must mean they're 'smarter' than everyone else! They WANT to latch on to the latest fad like they've been waiting for it their entire lives, it makes the feel like they're "ahead of the game". Hell, why else would perl get so much love and php so much hate? Php is great for the same tasks that perl is great for, yet the easier-to-use language is panned and the one that practically encourages you to write unreadable code is praised!

    Once they mature, they're learn that writing code that's easy to read and maintain is the single most important thing you can do. They'll learn that you don't get modularity for free just because you're using OOP (quite the opposite, in fact) and how proper modularity let's them write clean code that's easy to maintain. They may even learn that anyone who writes a FactoryFactory needs to be hung in the public square, and why doing something clever is a horrible idea 99.96% of the time.

    So, yes, development by fad (using closures in languages like c# and js, AOP, hell, even OOP) is a horrible, horrible idea. It makes insecure developers feel important, sure, but that is the only benefit it brings.

  135. Re:Recursive? No, very iterative. by PimpDawg · · Score: 0

    A language can't be fast or slow, that's up to the platform. I can compile java the language into a binary. Likewise I can run a C app in real mode DOS that requires expanded memory access and it would be very slow compared to an platform that has access to 64 bits of memory.

  136. Re:Recursive? No, very iterative. by PimpDawg · · Score: 0

    Heh? C# has been running on linux for a long time. It's called the mono project.

  137. Re:Good things about PHP by Anonymous Coward · · Score: 0

    That's not even remotely the browser. That's a module for the server.

    Do you mean runs in the server's process so it doesn't have to start an interpreter every time it's invoked?

  138. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 0

    C: Unsafe at any speed.

    C is not unsafe, your programming techniques are unsafe. C gives you a lot of control, but at the assumption that you will implement the safety checks yourself only when needed. That's why the language is so blazing fast in the first place. Safety checks eat cycles and make your binaries bigger.
    I certainly wouldn't use it by choice, but if it's what my project needs, I wouldn't shy away from it.

    C++: Overly complex

    Complex as it may be, the complexity is, for the most part, justified. The language remains widely used because it's fast and powerful. You can't have those without sacrificing ease of use.

    insane learning curve

    To learn to use the language efficiently to it's full potential, yes. To learn to use it as an effective tool, no.
    But really, the tools being difficult to use shouldn't be a deterrent for a professional. If you need the benefits of C++, you learn it despite the difficulties, or you can't be as competitive as the people who do.

    no garbage collection

    That's just not true. There are plenty of GCs for C++ and the standard library does give you a very basic reference counting for when GC is an overkill.

    And Java is possibly your most absurd point. Overly verbose to the extreme, slow, insane memory requirements, slow, crazy libraries, and slow (please don't bother to claim that isn't slow).

    Being slow is not really a bad thing for a language. I'd kill to be able to write every single piece of code in Python and not have to see another pointer ever again.
    That said, I don't really feel that Java gives me anything over C++. It's certainly not faster, and productivity wise, it's fairly similar. It's not inherently safer to use, and while C++ does give you some pretty unsafe capabilities, you can just not use those, while retaining the option if you end up needing it.

    I'm not really sure what kind of issue you have with Java libraries through. If a certain library doesn't give you what you want/need, what's stopping you from using another that does?

  139. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 0

    Sure we do, but I wouldn't call it bitching, more 'giving suggestions and positive criticism' , ok well , with occasional bitching :-)

    People dislike what they use, because they always look for something better ( it's human nature )

    That's why things keep improving, because the community demands it.
    If no one is complaining about your software, you have no idea what to improve.

    You say you like Java : Java is a good example of how community process improved something which was really awful and dreadfully slow , into something which is literally used everywhere ( I love Java btw ) .

    PHP has it's uses : it's very lightweight , and very fast , and as such , ideal for many basic sites.
    Not to mention the price tag in comparison to J2EE.

  140. Re:Fix? I think you mean, "migrate" by tibit · · Score: 2

    You've basically decided that you'll be stuck with software engineering as it was in the 70s and to hell with progress, because that's what you're used to. If you truly believe that you can be a good professional without continuously learning, I've got news for you: in no other engineering discipline I know of would that be true. Doctors and even nurses won't be renewed their licenses without proof of continuing education. Civil, mechanical and electrical engineers need to keep up with new technologies both in the design and the end product sides of the process. Even educators often need to do continuing education or their licenses will be taken away. This "academic functionality" you speak of has been, for the most part, engineered as a solution to oft faced problems. Problems you're apparently unaware of. Problems that make you less productive, make your code harder to maintain, and lose money for your employer.

    --
    A successful API design takes a mixture of software design and pedagogy.
  141. Singularity? by Setsquare · · Score: 1

    Singularity. Isn't that the next stage of evolution where nanotech and AI give us perfection and eternal life? Who would have thought the PHP community was at the forefront of machine intelligence?

  142. Re:Fix? I think you mean, "migrate" by tibit · · Score: 1

    Couldn't agree more. I'd actually argue that the "just get it done" mentality is only applicable to cute sample code. When you get even a 20kloc "production" code developed that way, it's usually a copypasta mess where 5% is probably publication-quality thedailywtf.com-grade material. When it gets to 200kloc, you've got a product that can't even be installed without hiring a consultant.

    Then it grows to order of 1Mloc, and you get Lotus notes where just a test deployment will take you a week if you're lucky and have never dealt with it previously. All completely gratuitous complications that are a clear indicator of how broken a code base it must be -- there's no fundamental reason why you can't have a working test system after installing the fine RPMs and not mucking much beyond that, thank you. Zimbra is about as far as I'm willing to endure with an "enterprisey" deployment. Anything more than that means that someone somewhere likes things complicated just to keep themselves (or their contractor buddies) occupied at all costs.

    --
    A successful API design takes a mixture of software design and pedagogy.
  143. Re:Recursive? No, very iterative. by Miamicanes · · Score: 1

    Java certainly isn't assembly language, but to be honest, the only time I ever find it to be *slow* anymore is if I forget to give the JVM more ram (damn you, Sun, and now Oracle, for refusing to give us a default option that says, "just use as much ram as you need until Windows runs out of physical ram and starts swapping too much"). Since sometime around 1.6, if there's any meaningful difference between the performance of C# and Java under Windows in any use case not involving DirectX, I haven't really seen it. C# compiles to intermediate object code that gets compiled to native code before running. Java compiles to JVM assembly language, which gets compiled to native x86 code at launch prior to running. Different nomenclature, same difference.

    The only area where Java really still falls on its face compared to .Net/C# is Swing... and Swing's problem isn't really *performance* anymore. Rather, it's the fact that Swing still firmly inhabits the "uncanny valley" where it mostly looks and acts like Windows, but doesn't inherit Windows' settings/history/context... so if you change the default scaling of Windows, or set custom favorite directories for the file dialog, or things like that, Swing doesn't change to reflect them. But actual speed hasn't really been an issue for a few years now. At least, not on anything quadcore, with at least 8 gigs of ram and running Windows or Linux (I'll grant that the Mac version of Java might still suck badly).

  144. Re:Fix? I think you mean, "migrate" by Anonymous Coward · · Score: 0

    If you're unable to understand as simple concept as closures (no, it's not complex), you're not a professional, you're a CS drop-out.

    Judging by your (mis)use of word "closure", you're indeed one of those. I mean, you don't like closures, but are you ok with non-capturing anonymous functions?

    Do you really find something like "Vector result = new Vector(); foreach (Person p : people) if (p.age minAge) result.push(p.name); return result" less smelly than "people filter (_.age minAge) map (_.name)"? I guess you should only find the filter part smelly, as it's passed a closure, unlike map, which gets an anonymous function without free variables, so it must be OK.

    Really, do go and educate yourself. Calling closures "hot new thing" just shows your ignorance. Even Rasmus already understood closures and included them in PHP, you're the only one struggling with a 50 year old concept of "function + variables in scope = closure".

  145. Re:Fix? I think you mean, "migrate" by Anonymous Coward · · Score: 0

    > Fortunately, the "closures this, aspects that, list operators!" group makes a ridiculous amount of money cleaning up the mistakes and horrible non-engineering of the people who "just want to get things done".

    And then the real engineers step in for yet more money to clean up the unmaintainable academic crap created in round 2. ;-)

  146. FCGI by Compaqt · · Score: 1

    >PHP's biggest problem - to me - is the lack of a FastCGI-style environment where code is already running and requests are just fed to the running daemon.

    Wha? PHP has plenty of frustrating problems, but that's not one of them.

    Setting up FastCGI with PHP ranges from easy to fancy. If you want easy, just install VirtualMin.

    Here's some guy with a custom setup:
    http://voidweb.com/2010/07/the-perfect-lamp-stack-apache2-fastcgi-php-fpm-apc/

    PHP with FCGI most decidedly does not go out of existence at the end of an HTTP request. The daemon stays there, ready for the next request. Also, why do you say APC is immature? Works pretty well in my experience. If you set the memory allocation right for the cache, the PHP code stays entirely (95%) in the cache.

    As for going from bytecode to machine code, yeah, OK. But how's that different for most uses of Python or Ruby--for the web. There's a Python C compiler, but people don't compile their web scripts.

    --
    I'm not a lawyer, but I play one on the Internet. Blog
  147. Hammers by Compaqt · · Score: 1

    Right hammer for the right job.

    Why would you need multi-threaded programming for CRUD operations on a blog site (like Slashdot)?

    Somehow or another, the executive mansion of the most powerful country on Earth seems to get by without closures, "cool" error handling (exceptions up the kazoo), and parallelism. (Whitehouse.gov runs Drupal, which is a CMS running on PHP and dumb old database like MySQL.)

    The world is also bigger than just Java. For my banking, I want Java on the backend. For other stuff? As situation requires.

    --
    I'm not a lawyer, but I play one on the Internet. Blog
  148. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 0

    Where I work, we write code in C, C++, and Java. Without fail, the Java code takes less time to write and has less bugs.

    In regards to your example, you have basically described a HashMap, for which pretty much all modern languages have an implementation. If you can calculate the index of the value you need in C, then you could calculate the hash lookup key in Java and use a Map.

    I do not disagree that C has options available to it that are unavailable to Java, and that you can almost by definition produce a faster C version of any program compared to the Java version. However, the magnitude of the difference will be generally small, and for actual written applications (not just theoretical ones), it is reasonably possible that the Java version could actually be faster (especially if the time to develop each is equal).

    So to call Java slow is generally not a true statement.

  149. Re:Good programmer = good COBOL code by Anonymous Coward · · Score: 0

    ...... I'm tired to read and hear that COBOL is shit.

    But it's really shit.

  150. Re:Recursive? No, very iterative. by dbIII · · Score: 1

    At work I use some stupidly expensive per licence software where the vendor decided in 2003 to just sack most of the C programmers and rewrite the entire thing in java. Now years later they've got the interface redone in java (it is a nicer interface though slower and uses insane amounts of memory for just a GUI interface - 2GB), but the backend remains in C apart from some java modules that are not quite ready for production use. I think it's about the right tool for the job instead of one language to rule them all.

  151. Re:Recursive? No, very iterative. by lennier · · Score: 1

    C is so awful that nowbody would dare use it for any serious stuff, like kernels or drivers!!!

    Exactly. And that's why our kernels and drivers never need monthly updates for 0-day security flaws.

    --
    You are not a brain: http://books.google.com/books?id=2oV61CeDx-YC
  152. Grammar nazi backfire! by dbIII · · Score: 1

    Google will help. Or the internet movie database.
    Of course since I'm correcting the correction the odds are good that I've misspelt something, and that my point that it's not worth going around being a grammar nazi will be lost.

  153. Comment removed by account_deleted · · Score: 1

    Comment removed based on user account deletion

  154. Please don't use engineering analogies that don't by dbIII · · Score: 1
    Please don't use incorrect engineering analogies that don't fit.

    but even worse is the labor, because CF has to be made by hand, there's no such thing as automated manufacturing of carbon fiber products

    There is but not for short production runs where it would cost more to set up automation than it would to do the entire run. It's carbon fibre reinforced plastic and items are fabricated in almost exactly the same way as glass fibre reinforced plastic, for instance those carbon fibre squash raquets, carbon fibre tubing, carbon fibre fishing rods etc etc. Doing only 100 left tailplane segements for a new jet fighter model is cheaper to do as individual items than to set up automation for just about any choice of material.

    Can we please drop the incorrect analogies and get back to PHP?

  155. Screw these programming languages. by xski · · Score: 1

    They're major impact has been to foster silly arguments and language wars.

    I say we dump this text crap and go back to switches with blinky lights.

    Who's with me?

  156. The problem isnt.. by pimpsoftcom · · Score: 1

    The problem isn't that nobody is willing to do the work, the problem is that people are not ALLOWED to do the work. Or worse, people who don't know as much as they think they do have the power to stop others by not allowing check ins that would fix problems. The upper tier of the dev team is full of themselves; They don't want to listen to others because they want to do things "their way" even when others have shown this to be incorrect. And they REFUSE to educate themselves, the PHP core dev team is like people from the deep south or something.

    --
    - d
  157. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 0

    Well, you seem to forget that you can complain about parts of something while loving the whole of it. Didn't you ever complain about something your girlfriend did because you were terribly annoyed at that moment?

  158. Re:Recursive? No, very iterative. by dbIII · · Score: 1

    I shouldn't give it away, but let's just say it's a bad idea to go hunting with the guy that used to be CEO of the company that supplies that software before he got into politics. We're gradually shifting stuff to better stuff from startups that's probably written by those original sacked programmers.

  159. Re:Recursive? No, very iterative. by Noughmad · · Score: 1

    C is so awful that nowbody would dare use it for any serious stuff, like kernels or drivers!!!

    It looks like you have a point, but look at it this way:

    PHP is so awful that nowbody would dare use it for any serious stuff, like business websites!!!

    --
    PlusFive Slashdot reader for Android. Can post comments.
  160. Re:Recursive? No, very iterative. by narcc · · Score: 1

    Missed some tricks from C, but once I learned how to properly program in an object oriented fassion things got a lot easier.

    You should tell some one. As it stands now, no one can agree on what OOP even means, let alone how to "program in an object oriented fashion".

    Hell, two of the most commonly cited "essential properties" of OO, encapsulation and inheritance, are opposed to one another! Not only is the paradigm ill-defined, the most common definitions are fundamentally incoherent!

    Why this fad didn't die in the early 90's I'll never know. Objects can be handy. Let's keep those around. Oh, and bring back agents; those made sense. OOP, on the other hand, needs to die and die quickly. While we're at it, the GoF need arrested and tried for crimes against humanity -- and anyone who's ever created a FactoryFactory tried as an accomplice. I can only begin to imagine how many billions of dollars they must have cost the global economy...

  161. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 0

    Benchmarks show Java is only 50 to 100% slower than C. Hotspot and GC are on long running application way more efficient then C regarding memory management. So check your facts before telling lies

  162. Re:Recursive? No, very iterative. by jez9999 · · Score: 1

    You made the rather important omission of C#. Or do you say that all Java's criticisms apply to it?

  163. Conservatism at its best by sivann · · Score: 2

    What's the new trend? Flames for PHP. Let's everyone join and destroy this shameful thing which is clearly aimed for noobs, not for us!
    But after 15 years and tens of thousands of lines of code in POSIX C, C++, Delphi, Perl, etc I found I like PHP the most! Why?
    Personal preference here:
    -Great syntax. Yes, great syntax.Which for me means:
        C-like blocks, not the delphi's funny stuff, not python's space-based block detection!. Who didn't try to remove semicolons or blocks for fun when they first wrote their first compiler? Well this isn't for fun. I want {.} not tabs and spaces. Why change something that works so good? Even friends who like python have nothing to say about this 'feature'.
    -sane array syntax. Not Perl's @,$,etc maddness.
    -lots of supported interoperability with OS shared libraries. And this code runs fast.
    -reliability. I don't recall seeing a segfault from a PHP process. Where I frequently see our python (2.6) processes segfaulting.
    -mod_php. Reliable. Works.
    -PDO database abstraction layer. I mean Oracle's OCI support was working fine even for external LOBs from 1999 in PHP3, but PDO was a step in the right direction.
    -Modern features added lately (closures, etc).
    -Great, and I mean great, documentation. That alone is a big plus.
    -Several good and easy enough Frameworks (I don't mean Zend)
    So we have a language which is reliable, supported, has modern features, can call most .so libraries I care about, has great DB interoperability, has a syntax I can work with, works good with apache. Why complain so much? Just point out what you don't like and request for changes. All this "I hate php with passion" seems very strange to me.
    -S

  164. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 0

    I Just read a description of some software that read "lightweight Java..." and then I started laughing.

  165. Webhost compatibility by Anonymous Coward · · Score: 0

    One of the reasons why PHP is still so popular is because you can get a hosting account at any cheap vendor, upload a PHP file, and expect it to work immediately. PHP has become an absolute necessity for webhosts to support, even Windows/IIS-based. Try finding one that doesn't support it.

  166. Re:Recursive? No, very iterative. by Hognoxious · · Score: 1

    Didn't you ever complain about something your girlfriend did

    Tumbleweed blows in the wind. In the distance, a bell tolls.

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  167. Esperanto by Tablizer · · Score: 1

    Esperanto?

    It's an "engineered" spoken language that intentionally removed most of the inconsistencies and unnecessary rules of organically-derived spoken languages.

  168. Re:Fix? I think you mean, "migrate" by maztuhblastah · · Score: 1

    Civil, mechanical and electrical engineers need to keep up with new technologies both in the design and the end product sides of the process.

    Counterpoint: we now have advanced composite materials that are a hell of a lot better than wood and all sorts of wiring designs that are more efficient, safer, and generally better than what we used in the 70s.

    And yet most new houses have at least a wooden frame and still have three-prong good ol' 120VAC outlets throughout.

    Why do you think that is?

    And before you say that's not a fair comparison, look at it this way: you can't change the electrical system without breaking compatibility and pissing off a lot of homeowners, and wood's usually good enough to get the job done.

    Both reasons apply to PHP.

    (Conterpoint to counterpoint: wood can easily go up in flames, and 120VAC is dangerous when used by children. Both of these points *also* apply to PHP.)

  169. Re:Recursive? No, very iterative. by Anonymous Coward · · Score: 0

    That's great, but not terribly demanding by modern standards. If you had written it in C++ using smart pointers & standard containers, it would run faster. End of discussion.

  170. Re:Fix? I think you mean, "migrate" by billcopc · · Score: 1

    Au contraire, mon troll.

    I read about these things, I've experimented with a lot of them, because I've been a coder since diapers. This is what I do for fun, oddly enough. I've read about and toyed with closures until it "clicked", but even then I still couldn't find a legitimate use for them. Sure, there were a few "hey I could pull this stunt" moments, but it was nothing more than a cheap hack, in lieu of a slightly more laborious but classically understood approach.

    If there is a common problem that is elegantly and optimally solved by closures, I have yet to encounter it. Unless that problem is having too many spare CPU cycles and not enough recursive stack frames.

    --
    -Billco, Fnarg.com