Answer the question
In order to leave comments, you need to log in
How to disable compile code in php?
There is a big cycle, on the test north it should display information, on the production it is easy to execute (as quickly as possible).
$debug=false;
$r=$f=0;
for ($i=1;$i<1000000000;$i++)
{
$r+=$i;
//debug info
if ($debug AND $i%1000000){
echo $r . PHP_EOL;
}
//debug info end
$f*=$i+$i;
//debug info
if ($debug AND $i%2000000){
echo $f . PHP_EOL;
}
//debug info end
}
Answer the question
In order to leave comments, you need to log in
If you have Opcache enabled and configured, then dead code is removed automatically: https://bugs.php.net/bug.php?id=71102
1) Leave everything as it is. To do this, make a simple time test, run it several times - I think even 1 billion simple checks will not really affect performance in any way
2) If it does so that it seems fundamental (which I doubt) - create two versions of the loop - with debug and without. Maybe this is not very good in terms of code cleanliness, but nothing else comes to mind
3) The problem here is even different - the script is very voracious, so an extra check will not play any role
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question