Test

<?php
function _fork() {
    $pid = pcntl_fork();
    if ($pid) {
        return $pid;
    } else {
        for ($j = 0; $j < 5; $j++) {
            $rnd = rand(0, 9);
            $txt .= "$rnd ";
        }
        echo "$txt\n";
        exit;
    }
}

$z = array();
shuffle($z);
for ($i = 0; $i < 5; $i++) {
    _fork();
}

usleep(10000);
pcntl_wait($status);
echo "\n";

$z[] = "Hello";
shuffle($z);
for ($i = 0; $i < 5; $i++) {
    _fork();
}

usleep(10000);
pcntl_wait($status);
echo "\n";

$z[] = "World";
shuffle($z);
for ($i = 0; $i < 5; $i++) {
    _fork();
}


/** Sample output: 
3 0 7 0 9 // Wrong
9 4 2 5 1
2 5 6 1 0
8 3 5 6 5
1 6 7 5 5

6 0 2 6 3 // Wrong
8 5 8 2 0
4 1 3 0 4
2 1 5 1 4
6 8 2 3 2

1 3 5 0 6 // Right
1 3 5 0 6
1 3 5 0 6
1 3 5 0 6
1 3 5 0 6
**/
?>