Is it possible to implement event driven program in PHP?
Something like javascript.
As an example, try to open a socket(open_socket)
and execute some other command(do_something_else)
instead of waiting for the success response of socket request.
After getting the success response execute callback_execute
.
//--------------------------------------------------------------------
public function open_socket(){
$this->socketResource = fsockopen($this->nodeIp,$this->portNumber);
}
public function callback_execute(){
fputs($this->socketResource,$command);
}
public function do_something_else{ xxxxx }
//--------------------------------------------------------------------
Non_blocking_function($obj->open_socket(),$obj->callback_execute());
$obj->do_something_else();