You can measure execution time in php using:
$inicio = microtime(true);
ejecutoFunction();
$fin = microtime(true);
//here getting the time passed
$tiempo = $inicio - $fin;
if($tiempo > $tiempo_limite) {//print it or do something else}
however verification happened "post-mortem", method ended before $tiempo is calculated, so it doesn't helps like this, because I need something that stops execution if it is taking more than x time. For instance,a function that performs a POST request to some URL and it is taking more than 10 sec to respond.
In a very mine fake code would be like this:
ejecutoFunction1(){
$timer = 0 seconds;
if $timer reaches 10 seconds{break ejecutoFunction1; ejecutoOtraFunction2();}
start $timer; //timer starts and allow executions until he reaches value 10.
{body of ejecutoFunction1}
}
How do I do that in real code in PHP ???? I know it is not easy (for me), but world class minds are reading here. Thanks in advance