+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 ; ?>

3/28/2020 11:00:05 PM

Nada Gaber

3 Answers

New Answer

+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.

+2

Oops There was a mistake, First: $$dollar => $dollardollar => 'dollardollar' Second: $dollar => 'dollardollar' Third: $$$dollar => $$dollardollar => $dollardollar => 'dollardollar'

+1

Thanks Mahmud Nabil