
meadow (from real life) // mid20s // I'm bnuuy ๐ฐ and also deer ๐ฆ and also a few more // wow!~!! //
๐ฉต @choir
๐ @queeronfire
![]() | ![]() |
|---|---|
![]() | ![]() |
|---|---|
![]() |
|---|
does that look up a variable at runtime by name using the value of $var as the name?
like
$var = "x";
$x = "banana";
echo $$var;
will that print banana?
see i've never done php but it works exactly the same way in perl so i just assumed
what's weird is that classic bourne shell doesn't even have this feature, and bash has it under a different syntax!
var=x
x=banana
echo "${!var}"
because in bash $$ is a variable itself, so $$var means the $$ variable followed by var, and ${$var} is a syntax error for some reason!