+ 2
Variable variables
<?php $a = 'hello'; $hello = "Hi!"; echo $a; ?> // why does this print out Hi! And not the hello part
6 odpowiedzi
+ 4
Using two $ means getting the variable with the name of the text written in variable a
It translate to:
$a = $hello = ‘hi’
+ 3
Well if you want to use a different variable depending on some circumstance, you can assign it later on the name to a string later on and reference it using two dollar signs
+ 1
Still doesn’t really make since to me
0
Why assign a with hello
0
Why would you use so many $$ like you did on that code when you already determined the variables
- 1
Ohhh I understand now