is it possible somehow change array which is processed by foreach? I tried this script
$iterator = 10; $cat = array(1 => \'a\',2 => \'b\',3 => \'c\');
The internet needs more cats! pass the array by reference instead and you'll get the desired result. note the &$cat in the loop.
&$cat
$iterator = 10; $cat = array(1 => 'a',2 => 'b',3 => 'c'); foreach($cat as $k => &$c) { if ($iterator < 15) { $cat[$iterator] = $iterator; $iterator++; } echo $c; }