I have this piece of PHP code:
echo 'PHP ' . phpversion()."\n";
$arr = array();
for ($i=0; $i<10; $i++)
{
$arr[] = new stdClass();
}
$it = new ArrayIterator($arr);
$i = 1;
foreach ($it as $obj)
{
$obj->test = $i;
$i++;
}
var_dump(current($it));
die();
Output on PHP 5.3 is as follows:
PHP 5.3.8
object(stdClass)#805 (1) {
["test"]=>
int(1)
}
Whereas output on PHP 7.4.8 is as follows:
PHP 7.4.8
file.php:33:boolean false
Why isn't this working anymore?