pcntl_fork_basic.phpt 756 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Test function pcntl_fork() by calling it with its expected arguments
  3. --CREDITS--
  4. Marco Fabbri mrfabbri@gmail.com
  5. Francesco Fullone ff@ideato.it
  6. #PHPTestFest Cesena Italia on 2009-06-20
  7. --SKIPIF--
  8. <?php
  9. if (!extension_loaded('pcntl')) die('skip pcntl extension not available');
  10. elseif (!extension_loaded('posix')) die('skip posix extension not available');
  11. ?>
  12. --FILE--
  13. <?php
  14. echo "*** Test by calling method or function with its expected arguments, first print the child PID and the father ***\n";
  15. $pid = pcntl_fork();
  16. if ($pid > 0) {
  17. pcntl_wait($status);
  18. var_dump($pid);
  19. } else {
  20. var_dump($pid);
  21. }
  22. ?>
  23. --EXPECTF--
  24. *** Test by calling method or function with its expected arguments, first print the child PID and the father ***
  25. int(0)
  26. int(%d)