Some things I hate about PHP

From LXF Wiki

Note that was originally the personal view of Paul Hudson, but others may have added or amended my words.

Having worked with PHP for more years than I care to think about, I've grown accustomed to its quirks and - in a bizarre sort of way - grown to appreciate them. However, some things still irk me no end, namely:

  • Silly function names. PHP originally had function names that were allonewordlikethis, such as strncasecmp(). However, over time this was deemed unreadable, so the_underscore_method was introduced, given functions such as str_word_count(). But then a naming convention for object-orientation was set, and they chose camel caps, which gives functionNamesLikeThis. Each of these is equally valid for function names, but I wish they would just choose one and stick with it. Clearly there is a need to maintain backwards compatibility, so the solution is to deprecate one style of function naming (probably the one without underscores, as it's a serious eyesore) but leave them in the language - encourage new users to use the new functions.
  • Random parameter ordering. Why does in_array() take $needle, $haystack whereas strpos() takes $haystack, $needle? Again, "that's the way it's always been done" is a fine answer for backwards compatibility, but makes the language harder for other people to learn.
  • Lack of developer forethought. PHP 5.0.0 was released on 24th November, PHP 5.0.1 was released on 28th November, with the first different listed being, "Native date class is withdrawn to prevent namespace conflict with PEAR's date package." PEAR is the offical repository for PHP extensions and other applications, and is very widely deployed across the web. Did no one bother to run a simple namespace check before releasing PHP 5.1? If not, why not?
  • String handling from the 80s. As a language designed for the web, you might think that PHP has excellent support for Unicode. It doesn't. In fact, if you want to do anything in Unicode, you end up having to write a lot of functions yourself to handle the characters because PHP for the most part treats a byte as a character. Don't even mention the multibyte extension.
  • Auto-creation of class variables with existing names and different visibilities. Here's some code:
  class Dog {
    private $Name = "Bowser";

  class Poodle extends Dog {

  $poppy = new Poodle();
  $poppy->Name = "Poppy";

So we have a class Dog that contains a private member variable, $Name. We have another class, Poodle, that extends Dog. We then create an instance of that class in $poppy, and set the Name variable to "Poppy". Do you get an error? No. You get a private variable and a public variable, like this:

object(poodle)#1 (2) {
  string(6) "Bowser"
  string(5) "Poppy"

Functions that are in Dog return "Bowser", and functions that are in Poodle return "Poppy". Madness!