Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to call a function inside async? #164

Closed
xLukii opened this issue Sep 4, 2021 · 1 comment
Closed

How to call a function inside async? #164

xLukii opened this issue Sep 4, 2021 · 1 comment

Comments

@xLukii
Copy link

xLukii commented Sep 4, 2021

Hello and in advance, thank you very much.

Sorry my ignorance, I would like to call a function that is outside the anonymous function, but doing so indicates that the function called "myFunction ()" does not exist, when in fact it does.

How can I call an external function?

     for ($ i = 0; $ i <count ($ result ['data']); $ i ++)
     {
         $ domain = $ result ['data'] [$ i] [6];
        
         $ pool [] = async (function () use ($ arg)
         {
             return myFunction ($ arg);
            
         }) -> then (function ($ response) use ($ arg)
         {
             var_dump ($ response);
         });
     }

From already thank you very much.

@spatie-bot
Copy link

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants