<?php function newchild ($func _name) {echo "Enter newchild\n";
$args = Func_get_args ();
unset ($args [0]);
$pid = Pcntl_fork ();
if ($pid = = 0) {function_exists ($func _name) and exit (Call_user_func_array ($func _name, $args)) or exit (-1);
else if ($pid = = 1) {echo "couldn ' t create child process";
else {return $pid;
} (PS: ^_^ Good PHP Development Communication group: 256271784, Validation: CSL, if you are interested can join in to discuss) function On_timer () {echo "Timer called\n"; /** * @param $func string, function name * @param $timeouts int, microtimes for time delay/function t
Imer ($func, $timeouts) {echo "Enter timer\n";
$base = Event_base_new ();
$event = Event_new ();
Event_set ($event, 0, Ev_timeout, $func);
Event_base_set ($event, $base);
Event_add ($event, $timeouts);
Event_base_loop ($base);
$pid = newchild ("Timer", "On_timer", 5000000); if ($pid > 0) {echo "Master process exit\n"; }