php - Can I set a time limit for a code block? -


is possible start block of code (maybe call function) , if doesn't execute within time skip it.

//give function 10 seconds execute $value = mega_function();// take 1-1000 seconds //if 10 seconds have passed , value still not set, abort , set $value = false; 

no. have either

  • call function inside external file using curl or file_get_contents() - can set timeout there

  • keep track of time inside mega_function() , return() if necessary.

what mega_function() do?


Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -