Hi gurus,

 

I've the following piece of PHP code....It is a simple logic but I can't
get it right....The output result of $id is "b"!!...It should be
"outside", right??

 

I think it is the variable $b....Coz' it depend on the previous check (
if ($a == 0) ) for the value... If this is the case, how can I get this
logic works??

 

Thanks a million,

Choy

 

 

 

 

<?php

 

            $a = 1;

            $id = "outside";

            

            if ($a == 0) {

                  

                        $b = 1;

                        $id = "a";

                  

            }

 

 

            elseif ($b == 0) {

                  

                        $c = 1;

                        $id = "b";

                  

            }

 

 

            elseif ($c == 0){

                  

                        $d = 1;

                        $id = "c";

                  

            }

 

            

 echo "ID = $id<br>"; //Output is "b"...WHY?? It should be "outside"...

 

 

 

?>

Reply via email to