I have a heavy processing script which can be started from a user via frontend in our intranet. Imagine something like this:
$html = file_get_contents($url);
$pattern = '/[A-Z0-9._%+-]+(@|\(at\)|\[at\])[A-Z0-9.-]+\.[A-Z]{2,4}\b/i'; //also (at) and [at]
preg_match_all($pattern,$html,$emails);
foreach ($emails[0] as $m)
{
$m[] = $m;
}
foreach($m as $n){echo $n."<br>";}
This is just an example for illustration of the question! Don't judge it on common sense.
NOW what i want is 2 things:
Stop the process on Click on a button from the user. This means: outputting the already collected array $m[].
Stop the process (or better: stop the array-collecting process and jump to the echo of the already collected array) based on time (for example max. 1 minute collecting the array, THAN jumping to echoing.
I don't want to echo live and setting max execution time will stop the script without echoing.
Thanks for your wise advise on both subquestions