+ 1

Can someone explain this challenge question to me?

What is the output of this code? $name="John"; $name="Lennon"; echo "$name $John"; answer is: John Lennon

5th Oct 2017, 4:01 PM
diane
diane - avatar
2 Respostas
+ 12
$name is resolved to $John (value of $name is John), which is a new variable declaration. "Lennon" is assigned to $John. So we have: $name = "John" and $John = "Lennon".
5th Oct 2017, 4:43 PM
Tashi N
Tashi N - avatar
+ 1
thanks! this makes sense!
5th Oct 2017, 5:16 PM
diane
diane - avatar