Created
October 15, 2017 08:17
-
-
Save dr5hn/40dec7cd3ccb2c79ce7305024028b6f9 to your computer and use it in GitHub Desktop.
How to create dynamic Variable Name or Create variable from variable in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$a = 'Hello'; | |
$$a = 'World!'; // This interprets $hello = 'world'; | |
echo "$a ${$a}"; //This will Print Hello World {PHP 7.0} | |
echo "$a $hello"; // This will also produce the same output Hello World | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment