Hi All, I am very new to programming and php so please do not lose patience with me if I asked some very simple questions.
I have been looking at this piece of code and it is very obvious that php tags have been placed at the beginning and end of a comment ?
From what I have learned (self taught), this is wrong ? All answers and help appreciated, many thanks in anticipation.
<?php
$print_invited_members .= "<br>";
$print_im .= $print_invited_members;}?>
<tr>
<td colspan="5">
<input name="no_response" type="submit" value="No response">
<input name="responded_yes" type="submit" value="Responded Yes">
<input name="responded_no" type="submit" value="Responded No">
<input name="move_to_attending" type="submit" value="Move to attending">
</td>
</tr>
</form>
</table>
<?php /////////********** CORRELATE MEMBERS *************////////////// ?>
<table style="vertical-align:top" align="center" width="800" border="1" bgcolor="E0FFFF" cellspacing="5">
<tr>
<td bgcolor="#00ff00" colspan="6">
<div align="center"> <a name="CM">BOOKINGS</a></div>
</td>
</tr>
Should comments have tags at the beginning and end ?
Moderator: General Moderators
Re: Should comments have tags at the beginning and end ?
Comments have to be marked as comments. However beeing in html mode it doesn't make very much sense raping a comment in php tags when just a simple <!-- Comment Here --!> would do the same without giving the server an extra php task just to ignore a comment.
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: Should comments have tags at the beginning and end ?
Code: Select all
<?php /////////********** CORRELATE MEMBERS *************////////////// ?>
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
-
gully_mi_seh
- Forum Newbie
- Posts: 14
- Joined: Fri Mar 18, 2011 8:48 pm
Re: Should comments have tags at the beginning and end ?
you should write all your comment on the same line with this method. Your closing php tags should not be at the same line than your comment. With the double slash you do not have to specify the closing comment tag. It just transform into comment the entire line starting after the starting comment tag. If you want to use a starting and a closing tag, you should use /* as starting and */ as ending.The open-close method is really effective for multi-line comment...
-
newphper
- Forum Commoner
- Posts: 26
- Joined: Mon Mar 21, 2011 1:48 am
- Location: Bridgeman Downs, Qld, Australia
Re: Should comments have tags at the beginning and end ?
Thank you all for the quick replies, It seemed wrong but being very new to php, I had to ask the question in case their was a valid reason for doing what was done. Cheers.