This is just a general PHP question. Does it help or hurt to have multiple <?php CODE ?>
in my scripts?
I was just looking at some of my scripts and noticed that some of them have 3-4 in it. Dont know if this is causing any slowness on my site or not :)
Together, you can use Apache and PHP-FPM to host multiple PHP web-applications, each using a different version of PHP, all on the same server, and all at the same time.
There are four different pairs of opening and closing tags which can be used in php.
A PHP code script is a text file having . php extension and is stored on web server. The PHP parser on server looks for special sequence of characters <? php and ?>. These are called PHP's opening and closing tags.
No, it's not causing any slowness or problems. It's perfectly common to have dozens or hundreds of separate <?php ?>
blocks in templates.
I guess you mean multiple PHP opening & closing tags.
Like in cases you want to echo a large block of HTML markup, it is always better to close the php tag ?> and then start it again when required. For example:
<?php
if($ok) {
?> A large
block
HTML MarkUp text
<?php
} //End of if($ok)
?>
It actually improves the speed as the control will not parse all of the above large block and simply skip to the next < ? php tag or If end point, as compared to echoing all these lines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With