What don’t you like about PHP?

Answered in Quora:

Q: What don’t you like about PHP?

It’s a ball of nails with almost no logic to it. From the perspective of software language design — as Tim Bray, co-creator of XML and at the time Directory of Sun Microsystems’s Web Technologies division, once said — “PHP is soul destroying.”

To take one of the most notorious examples: strpos and in_array.

In one, the order of variables is $needle, $haystack in the other it is $haystack, $needle. I challenge even the best PHP developers to remember which it is without a reference. Also, even though they both serve the same purpose they return different things and don’t obey a consistent naming convention: they should be named strpos/arrayin, posinstr/inarray or `str_pos`/`array_in`. That’s three terrible design choices in one single example!

Another example is the namespace separator in PHP is what is an escape sequence everywhere else \\. Why? Because by the time PHP added namespaces, they had run out of ASCII symbols for the lexer.

I could go on and on, but I won’t.

I love the language sometimes because I hate it so much. 😉

Come see my talk in February 2019 at SunshinePHP in Florida!

My beef with Quora

Last year back when Quora was beta, someone pointed this Quora entry out. I explained why this guy was mistaken and let it lie. But, since a friend sent it to me recently, I guess people are actually using Quora (or something) and this deserves a response

The page being discussed is part of a larger article I wrote (and never finished) here. In the page linked, there are almost none of my opinions, but rather a summary of what was provided by Haiping during a briefing at Facebook. The outline of the page is as follows:

  • PHP has some inherent advantages as a programming language for web development.
  • PHP has some disadvantages (for Facebook). The biggest are:
    1. High CPU
    2. High Memory usage
    3. PHP components are not easy to integrate from outside
    4. Extensions writing is not the same as PHP coding
  • There were multiple attempts at Facebook to migrate from PHP but they failed: Mainly because an re-architecture team cannot keep up with the new code that is being written by the rest of Facebook—mostly writing new PHP code. The year before the presentation alone had 4 attempts at internal migrations
  • Improving the PHP core was done at Facebook and, in fact, received a lot of mileage, but this was not felt to be sustainable vs. HipHop solution.

Continue reading about my beef with Quora after the jump