This is confusing me, can someone explain this to me. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

This is confusing me, can someone explain this to me.

<?php $a = 'hello'; $hello = "Hi!"; echo $a; // Outputs 'Hi!' ?> I don’t understand how this works. What does ‘echo $a;’ do. How would I use it. Helllpppp!

20th Nov 2018, 4:53 PM
Mail Exe
Mail Exe - avatar
4 Answers
+ 1
Think reverse $a = 'hello' => 'hello'=>$a $hello=$a $s='Hi!' Hope you understand one thing to note: use search bar
20th Nov 2018, 4:56 PM
Roneel
Roneel - avatar
+ 1
First you have double sign for variable => $. $a = 'hello', so we have $($a => 'hello'), next is $hello (first evaluating inner variable $a which is the string 'hello'), then the outer $hello (which is the string 'Hi!'). Hope it helps you :)
20th Nov 2018, 5:41 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
i dont really understand =/
20th Nov 2018, 4:59 PM
Mail Exe
Mail Exe - avatar
0
Nope, i still dont understand this :((((((((
20th Nov 2018, 5:42 PM
Mail Exe
Mail Exe - avatar