Is it ok in PHP to close out curly bracket as follows?
<?php function myfunction() { ?>
// stuff
<?php } ?>
<?php
// more stuff
I just discovered that this breaks my Wordpress site, however if I close out the bracket like this:
<?php function myfunction() { ?>
// stuff
<?php }
// more stuff
No problems are caused.
It's been a confusing afternoon! Any help much appreciated.
It is usually a bad idea to do:
?>
<?php
That adds output to the page, and prevents one from adding any headers, which may cause error if any code tries to add a header.
Whereas:
//nothing
Does not.
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