That's counterintuitive. Though I haven't concerned myself with formal grammar in too long to remember what makes the difference between what php does here and what one (at least I) would expect.Ok, here is a good one for programmers: Guess what it does print?
PHP:<!DOCTYPE html> <html> <body> <?php $arg = 'YES'; $vehicle = ( ( $arg =='YES')? 'train' : ( $arg =='NO' )? 'car' : ( $arg =='NO' )? 'horse' : 'feet' ); echo $vehicle; ?> </body> </html>
Try it out yourself with an online PHP program:
W3Schools online PHP editor
The W3Schools online code editor allows you to edit code and view the result in your browserwww.w3schools.com
That's counterintuitive. Though I haven't concerned myself with formal grammar in too long to remember what makes the difference between what php does here and what one (at least I) would expect.
Does someone care to elaborate? Is it the same here as with the dangling else?
$vehicle = true ? 'A' : false ? 'B' : 'C' ;
$vehicle = (true ? 'A' : false ) ? 'B' : 'C' ;
(note that in order to access the link you need to consent to many things)
That's counterintuitive. Though I haven't concerned myself with formal grammar in too long to remember what makes the difference between what php does here and what one (at least I) would expect.
Does someone care to elaborate? Is it the same here as with the dangling else?
You don't know the sadness you gave me...This is one of many PHP sadness: http://phpsadness.com/sad/30
Is that Zuckerberg?