Question:
Using PHP, is it possible to execute a function asynchronously?
Example:
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.
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 .