+ 1

why all the output is dollardollar

frist ... <?php $dollar = 'dollar'; $dollar = $dollar.'dollar'; $dollardollar = $dollar ; echo $dollar ; ?> second .. <?php $dollar = 'dollar'; $dollar = $dollar.'dollar'; $dollardollar = $dollar ; echo $dollar ; ?> third ... <?php $dollar = 'dollar'; $dollar = $dollar.'dollar'; $dollardollar = $dollar ; echo$$dollar ; ?>

28th Mar 2020, 11:00 PM
Nada Rizk
Nada Rizk - avatar
3 ответов
+ 3
$var refers to a variable, with a name which is the value of $var. For instance, if $foo = 'bar', $foo refers to variable $bar.
29th Mar 2020, 1:46 PM
Mahmud Nabil
Mahmud Nabil - avatar
+ 2
Oops There was a mistake, First: $dollar => $dollardollar => 'dollardollar' Second: $dollar => 'dollardollar' Third: $$dollar => $dollardollar => $dollardollar => 'dollardollar'
30th Mar 2020, 3:22 PM
Mahmud Nabil
Mahmud Nabil - avatar
+ 1
29th Mar 2020, 5:17 PM
Nada Rizk
Nada Rizk - avatar