Could you explain, in short (because reading and understanding How does PHP 'foreach' actually work? takes a lot of time), why does this infinite loop:
$foo = array(0, 1);
foreach($foo as &$v)
$foo[] = 42;
whereas this does not:
$foo = array(0); // 1 element at initialization
foreach($foo as &$v)
$foo[] = 42;
nor does this
$foo = array(0, 1);
foreach($foo as $v) // not using a ref as foreach iterator
$foo[] = 42;
?