Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7015179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:37:05+00:00 2026-05-27T22:37:05+00:00

I have to call a php function wich takes one second to response, in

  • 0

I have to call a php function wich takes one second to response, in a “for” loop :

    for ($i=0; $i<count($wsdlTab); $i++)
    {
        $serverLoadTab[$i] = $this->getServerLoad($wsdlTab[$i]);
    }

My problem is that I would like to call my getServerLoad($wsdlTab[$i]) function simultaneous for each row of my $wsdlTab[$i], to not have to wait one second on each loop.

That is the reason why I need to call that function in a thread.

I have seen various ways to “emulate” threads, but I have not found any way with my limitations :

  • I have to get the return value of my getServerLoad($wsdlTab[$i]), and put in in an array
  • The Apache server is on Windows

Thanks in advance for your responses.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:37:06+00:00Added an answer on May 27, 2026 at 10:37 pm

    PHP doesn’t really have asynchronous or threading built-in, as you’ve discovered.

    What I might do in a case like this is separate the script I need to execute in a parallel, putting it into its own, small and self-contained PHP file. Then I’d execute that in a separate thread, storing the result somewhere I could monitor in the original thread. Once all the scripts have returned and filled the results, or with some given timeout, I would then continue with processing.

    So, for instance,

    prepareResults(); // something like clearing a db row or zeroing out a file or whatever
    for ($i=0; $i<count($wsdlTab); $i++) {
        exec('./doServerLoad.php ' . $wsdlTab[$i] . ' &');
    }
    while (!waitingForResults()) { // checking the results table/row/file
    }
    $serverLoadTab = parseTheResults();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JavaScript function, pop_item . I have to call this from PHP,
Is there any way to have PHP automatically call a function, before a script
Is it possible to call a PHP function within an anchor tag. I have
I have a $.post function inside of a loop. All it does it call
I have a draggable element and I would like to call PHP function each
I have one php function on a seperate php file and I am calling
What happens when two different clients call the same php function that have pdo::beginTransaction?
Is it Possible to call php page under Javascript function? I have an javascript
I have a PHP function on my site which takes a couple of seconds
Does python have a function like call_user_func() in PHP? PHP Version: call_user_func(array($object,$methodName),$parameters) How do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.