Necuima Posted April 26, 2016 Share Posted April 26, 2016 Hi Larry, It's been a while since I've visited the forums so I hope that all is well with you. I have a question that you have already answered on page 51 and that is to do with the closing ?> The context I have is some php code that optionally 'requires' a php function which is the only thing in the .php file being 'required'. Is there any difference that the .php file which is the function is being optionally 'required' versus just 'required' in the normal code stream? The php file with the function does have the opening <?php tag but it is being included within a php code stream. Should I have the opening tag in the function 'include'? Originally I had the closing ?> in the function code and that worked fine in my development environment, but caused the error message in the production environment. My development environment is Windows 7 with xampp providing localhost. Many thanks in anticipation for your advice, or that of any other forum member. Cheers from Oz. Link to comment Share on other sites More sharing options...
Necuima Posted April 26, 2016 Author Share Posted April 26, 2016 I can't see how to edit my post - that should have read "conditionally 'requires'", rather than "optionally 'requires'". Sorry. Link to comment Share on other sites More sharing options...
Larry Posted May 15, 2016 Share Posted May 15, 2016 The simple rules of thumb are: - In order to have any file execute PHP code, it must put that code after the opening PHP tag - The last closing PHP tag in a file is optional So an includable file or an including file can omit the last closing tag (so long as you don't have HTML after it). Link to comment Share on other sites More sharing options...
Necuima Posted May 18, 2016 Author Share Posted May 18, 2016 Hi Larry, Thanks. Cheers from Oz. Link to comment Share on other sites More sharing options...
Recommended Posts