I have a function which can run for several minutes if server does not respond.
I need a method which would limit how long it can run and that it would also give me some kind of boolean feedback if开发者_Python百科 it goes over the limit.
EDIT: Script does not look very fancy it is simple function from one project`s API what is why I need to check if it running.
It looks something like this:
<?php
if(isset(theFunction($data)))){ //Some code}
?>
I just need to make theFunction() run for less than 5 sec.
And yes I am working with PHP.
I do not need that script would start over I just want to limit the runtime and skipe it if it exceeds it.
See: http://php.net/manual/en/function.set-time-limit.php
精彩评论