+ 1
1.Why the output of the following programme is b ?
<?php $a="b"; $b="c"; $c="a"; for($i=0;$i<1;$i++) $c=$c; echo $c; ?>
3 odpowiedzi
+ 12
Loop runs only once. So,
$c = $c
=> $c = $($c)
=> $c = $(a)
=> $c = b
+ 2
php has this neat thing where it can identify the name of a variable in the value of another.
I this case, $c == a
so $c would be $a
And $a is initialized to "b" above.
+ 1
it is because $c is like saying
$(value_of_$c) --> $a --> b