Live data from Hacker News

These are things in PHP which make me sad

phpsadness.com

1–10 of 217 posts

Re: These are things in PHP which make me sad

#4
post #2

This is by far my (least?) favorite: http://ca.php.net/empty ----- The following things are considered to be empty: - "" (an empty string) - [...] --> "0" (0 as a string) - [...] - var $var; (a variable declared, but without a value in a class) ----- Why the heck is "0" considered empty?

there's something wrong with the == and coercion in the if() statement in any language.

making the switch in if() be a boolean only pushes the problem off to the programmer, who will often choose the wrong function or expression to do the conversion

Re: These are things in PHP which make me sad

#5
Before everyone goes all "why don't you switch to language X or platform Y or lisp variant Z" I just want to say good job on this.

These all seem to be sane critiques of PHP without being all doomsday world-ending inflamatory. Kudos.

Also, I think that this is another example of how hard it is to build up a large and widely-used language/framework without having lots of warts. Especially since PHP wasn't originally designed with the intention of powering everything from a simple blog/cms to facebook.

Re: These are things in PHP which make me sad

#6
I've definitely run into #1 on the list. "Paamayim Nekudotayim" is a transliterated version of פעמיים נקודתיים‎, which means "double colon" in Hebrew. Zeev and Andi are Israeli, which kind of explains it, but the error message is still pretty useless.

Re: These are things in PHP which make me sad

#8

I've definitely run into #1 on the list. "Paamayim Nekudotayim" is a transliterated version of פעמיים נקודתיים‎, which means "double colon" in Hebrew. Zeev and Andi are Israeli, which kind of explains it, but the error message is still pretty useless.

Even in Hebrew, that is a useless error message...token names should mean what the token means, not what it looks like.

Re: These are things in PHP which make me sad

#9

php -r 'array("a","b")[0];' results in a parse error.

Resolving arrays like that causes parse errors in a range of contexts. Anything that is a "function" cannot also pick one array key... leaving a lot of XML-parsing code that looks like

$xml = getXpathWhatever(); $xml = $xml[0];

Stranger yet, is that it works perfectly fine with resolving objects... for example

$xml = funct()->something->somethingelse()->a

Works fine...

Re: These are things in PHP which make me sad

#10
post #2

This is by far my (least?) favorite: http://ca.php.net/empty ----- The following things are considered to be empty: - "" (an empty string) - [...] --> "0" (0 as a string) - [...] - var $var; (a variable declared, but without a value in a class) ----- Why the heck is "0" considered empty?

there's something wrong with the == and coercion in the if() statement in any language. making the switch in if() be a boolean only pushes the problem off to the programmer, who will often choose the wrong function or expression to do the conversion

> making the switch in if() be a boolean only

What exactly is the alternative?

If there's any problem here it's automatic coercion.

Post reply on HN