: K-Meleon Forum
General discussion about K-Meleon.
[quote=desga2] I tried your code in 1.5 and nothing is wrong. All result are correct: [code] $b = 1; $c = 2; $d = 3; $x = 4 ; #<<<--- this, [s]doesn't[/s] 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 [/code] 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]$b != $c ?[/b] 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: [code] $a = $b != $c ? $d : $x; [/code] It's possible that you are thinking in do some similar to this: [code] $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); [/code][/quote]
K-Meleon forum is powered by