Not many programming languages support this kind of feature. We are not talking about substitution of the values in a string. Instead, we want to reference the variable using strings in a dynamic manner. In PHP, the following code illustrates itself.
1 2 3 | $a = "1234"; $b = "a"; echo $$b; //output 1234 |
$a = "1234"; $b = "a"; echo $$b; //output 1234
This works because $b equals string a and $$b will just be deference as $a.
The same can be achieved using BASH.
Scripting languages are dynamic, loosely typed and do not require compilation, so it is likely that the languages supporting this feature are scripting.
–EOF (The Ultimate Computing & Technology Blog) —
GD Star Rating
loading...
177 wordsloading...
Last Post: How to Add a Share Dropdown Menu after Each Post? (Javascript)
Next Post: HP Stream 7 Signature Edition Tablet Review