1

Topic: Detaching a function

Is there any way in PHP to detach a running function so that it will continue in the background, so that the calling script may carry on with its tasks?


Cheers,

Matt

Re: Detaching a function

Not natively, PHP doesn't support multi-threading.

3 (edited by MattF 2008-01-04 02:31)

Re: Detaching a function

Cheers. smile

Edit: Just out of curiosity, does the 'not natively' bit mean there is an alternative way to do it?

Re: Detaching a function

If your installation supports system() calls, yes.

system('php script.php &');

Re: Detaching a function

You can also call a script through the webserver via fsockopen.
However, again, those are not real multi-threading tongue

6

Re: Detaching a function

Cheers chaps. Greatly appreciated. smile