xref: /PHP-8.1/tests/lang/bug24396.phpt (revision 782352c5)
1--TEST--
2Bug #24396 (global $$variable broken)
3--FILE--
4<?php
5
6$arr = array('a' => 1, 'b' => 2, 'c' => 3);
7
8foreach($arr as $k=>$v)  {
9    global $$k; // comment this out and it works in PHP 7 too..
10
11    echo "($k => $v)\n";
12
13    $$k = $v;
14}
15?>
16--EXPECT--
17(a => 1)
18(b => 2)
19(c => 3)
20