PHP 7中的间接变量

I have a code which takes javascript from database and render it for particular page. In javascript are used substitutions for php variables which should be replaced by actual value of php variable. Substitutions look like {{_GET.page}} should be replaced by value of $_GET['page']

for PHP 5.6 i am using following code and all works good

if(isset($adminpage['js']) && $adminpage['js'] != ''){
    preg_match_all('#\{{(.*?)\}}#', $adminpage['js'], $match);
    foreach($match[1] AS $k => $m){
        $m = explode('.', $match[1][$k]);
        if(isset($m[1])){
            $match[1][$k] = ${$m[0]}[$m[1]];
        }else{
            $match[1][$k] = $$m[0];
        }
        $adminpage['js'] = str_replace($match[0][$k],$match[1][$k],$adminpage['js']);
    }
    $jsfiles[] = '
<script type="text/javascript">'
.$adminpage['js'].
'</script>';
}

But it does not work in PHP 7. Does anyone know what how to change it and explain pls? Thanks

Just found out what was the problem :)

if(isset($m[1])){
    $match[1][$k] = ${$m[0]}[$m[1]];
}else{
    $match[1][$k] = ${$m[0]};
}

Curly Braces in second case was missing. Strange because in PHP 7 should be curly braces changed to normal braces according to this: http://php.net/manual/en/migration70.incompatible.php