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($thread, $task); } function forkTask($thread, $task) { if($task==1) { $thread = 4321; } return; } print_r($threads);
based on GJPNH
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
Array ( [1] => 1234 [3] => 7462 [4] => 8472 )