PHP - To echo or not to echo?

前端 未结 7 1033
[愿得一人]
[愿得一人] 2021-01-31 06:05

What is more efficient and/or what is better practice, to echo the HTML or have many open and close php tags?

Obviously for big areas of HTML it is sensible

7条回答
  •  抹茶落季
    2021-01-31 06:13

    I've made myself the same question long time ago and came up with the same answer, it's not a considerable difference. I deduct this answer with this test:

    test  :)$function) {
                $start = microtime(true);
                for ($i=0;$i<$amount;$i++) {
                    $function($idx);
                }
                $time = microtime(true) - $start;
                $result[$idx.'_'.$function] = $time;
            }
            ob_end_clean();
            return($result);
        }
    ?>
    

提交回复
热议问题