Memory App
Php
 



Programming > Php > Variables > Variable variables   ZCE 5.3  |  Patterns Php  |  Modern Php

Constraints

It is possible to create variables whose names do not follow the constraints. Variable variables are a very powerful tool, and should be used with extreme care. Their improper use can lead to some significant security issues.

$name = '123';

$$name = '456';

echo ${'123'}; // output 456
(1/2)

Function

A technique similar to variable variables can also be used to hold function names:

function myFunc() {
    echo 'myFunc!';
}

$f = 'myFunc';

$f();  // output myFunc!

Questions










Top Reference > Programming
0/0 (80)  
Save
3