开发者

Closing and opening the php tag [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

PHP: Opening/closing tags & performance?

this is probably a开发者_运维问答 stupid question, but being extremely perfectionist i thought I'd ask just for curiosity:

Is there a perfomance issue if opening and closing the "php" tag to many times ?

I mean, is there a consequence performance speaking using this

<?php
    $track_id = 418; //default
?>

<?php include('includes/popup_biography.php'); ?>  

instead of this :

<?php
    $track_id = 418; //default
    include('includes/popup_biography.php');
?> 


I don't know of any performance issue. There might be a very minor performance issue due to the emission of what is between the two statements, but I think it would be unnoticeable.

However, you should not break out of php for a different reason: this emission prevents you from sending any other headers with your request. I think that breaking out of php to print is an antiquated notion and should be avoided entirely. If you are going to do it, reserve it for printing the results of your logic (all done long before any printing, probably in a different file).


Take a look at PHP: Opening/closing tags & performance?

The performance differences are so minuscule that you shouldn't fret over it whatsoever.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜