Skip to content

Instantly share code, notes, and snippets.

@shin1x1
Created May 20, 2011 01:32
Show Gist options
  • Save shin1x1/982175 to your computer and use it in GitHub Desktop.
Save shin1x1/982175 to your computer and use it in GitHub Desktop.
sleep sort
<?php
$list = range(1,10);
shuffle($list);
foreach ($list as $i) {
$pid = pcntl_fork();
if ($pid === -1) {
die('fork error');
} else if ($pid === 0) {
sleep($i);
echo $i;
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment