Quantcast
Channel: Executing functions in parallel - Stack Overflow
Browsing all 8 articles
Browse latest View live

Answer by Farab Alipanah for Executing functions in parallel

There's Guzzle with its concurrent requestsuse GuzzleHttp\Client;use GuzzleHttp\Promise;$client = new Client(['base_uri' => 'http://httpbin.org/']);$promises = ['image' =>...

View Article



Answer by Harry for Executing functions in parallel

What you are looking for is parallel which is a succinct concurrency API for PHP 7.2+$runtime = new \parallel\Runtime();$future = $runtime->run(function() { for ($i = 0; $i < 500; $i++) { echo...

View Article

Answer by Danny Michaeli for Executing functions in parallel

you can use "PTHREADS"very easy to install and works great on windowsdownload from here ->http://windows.php.net/downloads/pecl/releases/pthreads/2.0.4/Extract the zip file and thenmove the file...

View Article

Answer by Matt Esch for Executing functions in parallel

The only waiting time you suffer is between getting the data and processing the data. Processing the data is actually completely blocking anyway (you just simply have to wait for it). You will not...

View Article

Answer by Michal for Executing functions in parallel

Not sure if a solution for your situation but you can redirect the output of system calls to a file, thus PHP will not wait until the program is finished. Although this may result in overloading your...

View Article


Answer by Björn for Executing functions in parallel

If you'd like to execute parallel tasks in PHP, I would consider using Gearman. Another approach would be to use pcntl_fork(), but I'd prefer actual workers when it's task based.

View Article

Answer by Jim for Executing functions in parallel

Have a look at pcntl_fork. This allows you to spawn child processes which can then do the separate work that you need.

View Article

Executing functions in parallel

I have a function that needs to go over around 20K rows from an array, and apply an external script to each. This is a slow process, as PHP is waiting for the script to be executed before continuing...

View Article

Browsing all 8 articles
Browse latest View live


Latest Images