If I include or require one PHP script from another, e.g. include 'header.php';, should the included PHP script also use the opening <?php and closing ?> tags, or not?
Whether the tags are present or not, the script loads correctly. But I’m unsure which is the correct procedure. My concerns are: (1) by using the tags again the PHP engine might start up twice and waste resources, (2) by not using the tags, this may be incorrect and could break in future, also other people might be able to see the PHP code (if it were inside of the public directory).
EDIT
People are misunderstanding this question. Here is some background: when you include or require a file it is dropped into place in the parent file dynamically and they are parsed as one script. The included script is not executed/interpreted separately, it just continues. This is why the tags are NOT needed. That is not my question. My question is whether it is better (recommended by PHP?) to use the PHP tags in this case, or to exclude them entirely from the included scripts.
If your include/require file is PHP, open it with the php tag
<?php. Generally, you don’t close the php tag if there is nothing after it as it is optional.http://php.net/manual/en/language.basic-syntax.instruction-separation.php