LOL. I know what an if else clause do. But in this case both should print. When fork is called the process divides in two processes. The first process is the parent and so it prints when IF clause(because $pid in this case will be the pid of the child so it's bigger thank zero. The second is the child so it prints when ELSE clause(the $pid in this process is 0). They both print, that program is a simple test to multiprocessing .
Anyway...
User Profile
Collapse
-
Code:Rizladonovich Well, your control-flow does not allow more than one statement to be printed, as is correct.
Leave a comment:
-
pcntl_fork suport instaled but not working correctly
Greetings.
First of all I must apologyse for my english.
I have used multi processing before in C but know I have a project that it would be usefull to use it in php.
Here comes the problema I installed php support for pcntl_fork and when running a simple test program It does not work correctly.
Code:$pid = pcntl_fork(); if ($pid != -1) { if ($pid) { print "In the
Last edited by Niheel; Sep 18 '10, 10:31 PM.
No activity results to display
Show More
Leave a comment: