Re: PHP tags - any reasons to close ?>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jason Pruim schreef:

On Sep 23, 2008, at 9:27 AM, Jochem Maas wrote:

Martin Zvarík schreef:
Hi,
I have seen some projects where people start with opening tag <?php but they DON'T close it with ?>
This is especially the case of CONFIG.php files...
1) What's the reason of that?
2) What if you would not close any 100% PHP files?

I second what Robbert and Richard said, actually I'm pretty
sure I've read Rasmus himself advocate the practice of leaving
out the closing php tag on files that contain no output

Before I go and change all of my include files... I just want to make sure if "output" would be considered inside a function that sets session variables, and then simply returns at the end? Once I'm done debugging, I'll have some functions like that hopefully. :)

by 'output' I meant any 'plain text' hanging around outside of php tags, e.g.:

foo.php
---------
<?php

function myFunc()
{
	return "Hello World";
}
	
echo myFunc();

// the rest (after '?>') I'm calling 'output'
?> some static output<br />
isn't it great!<hr />


---------

more specifically 'output' after the last block of php in a file. basically EOF
implies '?>' (if your in a php block) so why type '?>' and take the risk of
having some trialing white space screw up your app.

sorry for the confusion my output may have caused ;-)


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
japruim@xxxxxxxxxx






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux