<?php $pids = array(); for ($i=1; $i<$argc; $i++) { if (($pid = pcntl_fork()) == 0) { $sleep = intval($argv[$i]); sleep($sleep); echo $sleep."\n"; exit(); } else if ($pid == -1) { die(); } else { $pids[] = $pid; } } foreach($pids as $pid) pcntl_waitpid($pid, $status); ?>