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

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -