This C code does what I expect:
It prints the number 2.Code:#include <stdio.h> int main(){ int x = 3; int y = (x<3)?1:(x<4)?2:(x<6)?3:4; printf("%d\n", y); return 0; }
This PHP code does not:
Instead I get 3Code:<?php $x = 3; $y = ($x<3)?1:($x<4)?2:($x<6)?3:4; echo $y."\n"; ?>
It only seems to evaluate the last expression. Anyone know if this would be a bug, or if there is a reason for this?
I dont like it
Edit: found the answer, http://bugs.php.net/bug.php?id=25356. Guess I should have searched first...