$pid = pcntl_fork(); switch($pid) {
case 0:
// Child process
call_user_func($callback, $data);
posix_kill(posix_getppid(), SIGCHLD);
exit;
case -1:
// Parent process, fork failed
throw new Exception(“Out of memory!”);
default:
// Parent process, fork succeeded
$processes[$pid] = TRUE; } Wednesday, December 5, 12