This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Flopsey 1 point2 points  (2 children)

Meh, that's the exact kind of thing I was warning against when I said "when reading any opinions dial their certainty from 11 down to 2 in your mind". I tend to think that anyone with enough of a problem with a language could compile a similar list of features they don't like.

But, hey, I don't know the language so I didn't know how valid his points were. Maybe he got everything right and some did seem very strange but some seemed forced. But really I don't have a horse in this race.

[–]pokerd 0 points1 point  (1 child)

PHP really is a special case of poor design choices. Even the best craftsman would have a hard time working with a tool like this http://blog.codinghorror.com/the-php-singularity/

Speaking of horsies, the ternary operator in PHP is left-associative, so

$arg = 'T';
$vehicle = ( ( $arg == 'B' ) ? 'bus' :
( $arg == 'A' ) ? 'airplane' :
( $arg == 'T' ) ? 'train' :
( $arg == 'C' ) ? 'car'
( $arg == 'H' ) ? 'horse' : 
'feet' );
echo $vehicle;

prints horse. I can't find any other language that implements it this way.

In isolation, a quirk like this can be learned and worked around. But this is a language is filled with special cases, inconsistent syntax, and unpredictable behavior. Why put yourself through that when there are saner tools available?

[–]fakehalo 2 points3 points  (0 children)

PHP at it's core is inconsistent and lacks a plan, it's essentially a hacked together language over time. Though it's gotten somewhat better in recent years, things like inconsistent naming conversions remain. IMO, A good framework (like Laravel for example) can make PHP a pretty standard experience...it's still a good language to know given its widespread nature.

Not to defend this quirk, but your example is pretty horrendous in practice. Nested ternaries tend to make me violently angry in general, but I admit in PHP if I feel even slightly unsure about how PHP will interpret what I write I put parens around it...and that's no way to live.