php variable variables problem

后端 未结 2 1222
被撕碎了的回忆
被撕碎了的回忆 2021-01-19 05:23
$_POST[\'asdf\'] = \'something\';

function test() {
    // NULL -- not what initially expected
    $string = \'_POST\';
    echo \'====\';
    var_dump(${$string});         


        
2条回答
  •  感动是毒
    2021-01-19 05:59

    Look at here

    Please note that variable variables cannot be used with PHP's Superglobal arrays within functions or class methods. The variable $this is also a special variable that cannot be referenced dynamically.

提交回复
热议问题