3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $threads = array(1=>1234, 3=>7462, 4=>8472); foreach($threads as $task=>$thread) { forkTask($task); } function forkTask($task) { global $threads; if($task==1) { $threads[$task] = 4321; } return; } print_r($threads);
based on 4PcGh
Output for 4.3.0 - 7.1.0
Array ( [1] => 4321 [3] => 7462 [4] => 8472 )