I tried your code in 1.5 and nothing is wrong. All result are correct:
$b = 1;
$c = 2;
$d = 3;
$x = 4 ;
#<<<--- this, doesn't work
$a = $b != $c ? $d : $b != $c ? $d : $b != $c ? $d : $x;
#when b&c are 1 a equal 4 %%% 1st false 2nd false 3rd false
#when b=1 and c=2 a equal 3 %%% 1st true
alert($a, "first value of $a");
# Alert show a=3, this is correct, B and C are differents A=D=3, rest of expresion aren't evaluated because the first is true and a true value in first only asign A=D
# If B=C=1 then A=X=4 because 1st false 2nd false 3rd false
I don't know because you think this is wrong.
In my own opinion this is a stupid code because you ever check the same expresion:
$b != $c ?
And this expresion not changed it's the same that the first and you ever asign it the same value D if this is true and X if finally is false.
I wrote this line of code:
$a = $b != $c ? $d : $x;
It's possible that you are thinking in do some similar to this:
$a = $b != $c ? $d : $b != $d ? $c : $b != $x ? $d : $c;
#when b&c are 1 a equal 1 %%% 1st false 2nd true 3rd not checked
#when b=1 and c=2 a equal 3 %%% 1st true
# Or something like this:
$a = $b != $c ? ($b != $d ? $c : $d) : ($b != $x ? $d : $c);
K-Meleon in Spanish
Edited 1 time(s). Last edit at 08/27/2008 12:57PM by desga2.