Execute PHP function asynchronously


Using PHP, is it possible to execute a function asynchronously?


The client(browser) makes a request to the server, in this request PHP executes an asynchronous function that can take a few seconds, but before it ends, the server responds to the client so that while the asynchronous operation is being executed, the browser no need to wait for it to finish to get an answer.


Yes, from some external libraries it is possible to implement similar things in a very simple way.

The most well-known project is reactPHP .

There is a very interesting benchmark comparing reactPHP with nodeJS .

Scroll to Top