PHP 8.5.0 Alpha 2 available for testing

Voting

: max(nine, zero)?
(Example: nine)

The Note You're Voting On

manishpatel2280 at gmail dot com
12 years ago
Its been easy to fork process with pcntl_fork.. but how can we control or process further once all child processes gets completed.. here is the way we can do that...

<?php
for ($i = 1; $i <= 5; ++$i) {
$pid = pcntl_fork();

if (!
$pid) {
sleep(1);
print
"In child $i\n";
exit(
$i);
}
}

while (
pcntl_waitpid(0, $status) != -1) {
$status = pcntl_wexitstatus($status);
echo
"Child $status completed\n";
}
?>

<< Back to user notes page

To Top