Does going in and out php tags slows down overall execution process?
one text
Solution:
Well I honestly don't know. So the only way to find out is to create a small benchmark script.
I have created a benchmark script before so I modified my code to suit your question :
<?php
function loadtime_start(){
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
return($start);
}
function loadtime_end($start){
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round(($finish - $start), 4);
return($total_time);
}
$start = loadtime_start();
for($i = 0; $i<100000; $i++){
?>
We have something I guess bro!<br />
<?php
}
$inout_time = loadtime_end($start);
$start = loadtime_start();
for($i = 0; $i<100000; $i++){
echo 'We have something I guess bro!<br />';
}
$php_echo_time = loadtime_end($start);
echo 'Time for in / out : '.$inout_time.PHP_EOL.'Time for PHP echo :'.$php_echo_time;
Simply run this script and you'll know the result.
My results are :
Time for in / out : 0.1009 Time for PHP echo :0.1705
Source