A little dab'll do ya
Code Snippets
Variable Variables
<?php
$var1 = 'nameOfVariable';
$nameOfVariable = 'This is the value I want!';
echo $$var1;
?><?php
$var1 = 'nameOfVariable';
$nameOfVariable = 'This is the value I want!';
echo $$var1;
?>
Mind you can also do that with more $s:
And you can use curly brackets:
Mind you can also do that with more $s:
<?php
$var1 = 'var2';
$var2 = 'nameOfVariable';
$nameOfVariable = 'The value I want!';
echo $$$var1;
?>
And you can use curly brackets:
<?php
$var1 = 'nameOf';
$var2 = 'TheVariable';
$nameOfTheVariable = 'Another value I want!';
echo ${$var1 . $var2}; // Use concatenation to generate the variable name and then access it //
?>
no