Re: Re: Why PHP sucks - farce or is there a bit of truth?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 18, 2013 at 12:02 PM, Jim Giner <jim.giner@xxxxxxxxxxxxxxxxxx>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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux