denoteone Posted March 7, 2008 Share Posted March 7, 2008 why if the page is a .PHP file would the file look like <?PHP <?PHP session_start(); session_destroy(); ?> <?PHP print "html output"; print "more html output"; ?> why if it is all php is the page broken up by multiple php tags. I know I should probably know this.... Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 7, 2008 Share Posted March 7, 2008 Having multiple opening and closing php tags is just poor programming practice and it leads to other errors, like having white-space output to the browser when there are newlines between one closing tag and the next opening tag... Contiguous php code should have one opening tag and one closing tag. Quote Link to comment Share on other sites More sharing options...
denoteone Posted March 7, 2008 Author Share Posted March 7, 2008 thanks! Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted March 7, 2008 Share Posted March 7, 2008 Having multiple opening and closing php tags is just poor programming practice and it leads to other errors, like having white-space output to the browser when there are newlines between one closing tag and the next opening tag... Contiguous php code should have one opening tag and one closing tag. It isn't "poor programing" its a valid technique to writing php and when done properly it is useful. example of valid use <?php session_start(); include('constants.php'); include('shell_top.php'); ?> <h3>Welcome to my site</h3> <p>I thought I take a break from php so I didn't have to escape all my "Quotations"<br />This is perfectly legal</p> <?php echo "Well I'm back in php now because I needed to echo the variable of the date!<br />The Date is :".date("Y/m/d").".</p>"; ?> It is valid to go back in forth like I just showed to make it easier to write. however the following example is very poor writting. <?php session_start(); ?> <?php include('constant.php'); ?> Hi <?php echo "Bye"; ?> Logically it makes no sense to do stuff like this Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 7, 2008 Share Posted March 7, 2008 I'm guessing that you did not read the original question or my reply very closely. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.