3 ms·
Yes, but how do you handle the result? You will need a closure to store the context you had when you made the function call. That is async.
by EGreg 9y ago
Yes, but how do you handle the result? You will need a closure to store the context you had when you made the function call. That is async.
- laurencei 9y agoThe queue is given the command. The command has the functions I want to run, including the context and what I want done with the result. It can be a closure right up to a full class. Using a framework like Laravel I can even "chain" queued commands - so CommandA will queued, then call CommandB when it is done etc. I've never run into a situation that wasnt easily solved by this.
- EGreg 9y agoOK so what environment is the function being executed in? That environment is outside of PHP. Now when it comes time to do the callback, is the PHP thread still running, or not?