Re: Re: Why PHP sucks - farce or is there a bit of truth?
| From: | David Harkness | Date: | Fri, 18 Oct 2013 19:20:51 +0000 |
| Subject: | Re: Re: Why PHP sucks - farce or is there a bit of truth? | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322317@lists.php.net to get a copy of this message | ||
On Fri, Oct 18, 2013 at 12:02 PM, Jim Giner <jim.giner@albanyhandball.com>wrote:
> That said I see the 'proper' expectation of this statement:
>
> $foo = $a ? $b : $c ? $d : $e;
>
> as:
>
> $foo will be the result of "if $a then $b else if $c then $d else $e;"
>
> Why php interprets it differently is just not logical to me.
While I agree that PHP probably should have matched other languages like C
and Java, a) I have never needed to use this double construct, b) I
wouldn't even if it made sense due to the likely confusion, and c) PHP has
the Elvis operator ($x ?: $y) which is pure awesomeness so I can forgive
it's wonky ternary precedence.
Far more troublesome with PHP is the mixed parameter ordering in the
built-in functions. The quote on the top of that page says it all. I'm
constantly having to rely on code-completion for functions I've used for
years to make sure I'm getting the order right. Haystack before needle or
needle before haystack? Both! :(
Cheers,
David