Is there any equivalent to javascript
setTimeout
method in php
?
what I know that php is not multithreading but I could be wrong.
Is there any equivalent to javascript
setTimeout
method in php
?
what I know that php is not multithreading but I could be wrong.
No, there isn't. Mainly because PHP is server-sided so it wouldn't make much sense to have timed events. There is, though, the sleep
function which halts the execution for a given time.
You can do multi-threading in PHP with pthreads
From PHP manual:
pthreads is an Object Orientated API that allows user-land multi-threading in PHP.
It includes all the tools you need to create multi-threaded applications targeted at the Web or the Console.
PHP applications can create, read, write, execute and synchronize with Threads, Workers and Stackables.
References
1) http://www.reddit.com/r/PHP/comments/1jo517/multithreading_in_php_with_pthreads/
PHP has threads so you can fork
like you would in other multithreaded languages.
You can always make your own event-loop of course ;)
There is no way that you can get a JS equivalent. Has nothing to do with that. Are different technologies.
I dont know what are trying to do. But you can set the max_execution_time on for php.ini file or override that value at script level.
take a look at