Click to See Complete Forum and Search --> : php multithreading


sakherq
07-21-2008, 08:47 AM
hello iam writing a php script and want to it perform it's expected job faster.
the script give a sequence of orders to run a function.


function some_work($x)
{
//do $x job;
}

some_work(7625);
some_work(8432);
some_work(762545);
some_work(843254);
some_work(7542625);
some_work(65428432);

can i run these functions in a multithread mode to get faster execution ?
know how ?

NogDog
07-21-2008, 09:04 AM
PHP does not have native support for multithreading. There are various ways to emulate it, though the overhead involved may reduce any benefit obtained. See this article (http://www.ibuildings.nl/blog/archives/811-Multithreading-in-PHP-with-CURL.html) - including the comments at the end - for some ideas.

ellisgl
07-21-2008, 10:36 AM
Forking is evil. I wish they would think about making PHP having real multi threading abilities.