<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML ><HEAD ><TITLE >Comments</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual PHP" HREF="index.html"><LINK REL="UP" TITLE="Basic syntax" HREF="language.basic-syntax.html"><LINK REL="PREVIOUS" TITLE="Instruction separation" HREF="language.basic-syntax.instruction-separation.html"><LINK REL="NEXT" TITLE="Types" HREF="language.types.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-2"></HEAD ><BODY CLASS="sect1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="language.basic-syntax.instruction-separation.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Cap. 5. Basic syntax</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="language.types.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="language.basic-syntax.comments" >Comments</A ></H1 ><P > PHP supports 'C', 'C++' and Unix shell-style comments. For example: <DIV CLASS="informalexample" ><P ></P ><A NAME="AEN562" ></A ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /> </font><font color="#007700">echo </font><font color="#DD0000">"This is a test"</font><font color="#007700">; </font><font color="#FF8000">// This is a one-line c++ style comment<br /> /* This is a multi line comment<br /> yet another line of comment */<br /> </font><font color="#007700">echo </font><font color="#DD0000">"This is yet another test"</font><font color="#007700">;<br /> echo </font><font color="#DD0000">"One Final Test"</font><font color="#007700">; </font><font color="#FF8000"># This is shell-style style comment<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ><P ></P ></DIV > </P ><P > The "one-line" comment styles actually only comment to the end of the line or the current block of PHP code, whichever comes first. </P ><P > <DIV CLASS="informalexample" ><P ></P ><A NAME="AEN566" ></A ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <h1>This is an <font color="#0000BB"><?php </font><font color="#FF8000"># echo "simple";</font><font color="#0000BB">?></font> example.</h1><br /><p>The header above will say 'This is an example'.</font> </code></TD ></TR ></TABLE ><P ></P ></DIV > </P ><P > You should be careful not to nest 'C' style comments, which can happen when commenting out large blocks. </P ><P > <DIV CLASS="informalexample" ><P ></P ><A NAME="AEN570" ></A ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /> </font><font color="#FF8000">/* <br /> echo "This is a test"; /* This comment will cause a problem */<br /> </font><font color="#007700">*/<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ><P ></P ></DIV > </P ><P > The one-line comment styles actually only comment to the end of the line or the current block of PHP code, whichever comes first. This means that HTML code after <VAR CLASS="literal" >// ?></VAR > WILL be printed: ?> skips out of the PHP mode and returns to HTML mode, and <VAR CLASS="literal" >//</VAR > cannot influence that. If <A HREF="ini.sect.language-options.html#ini.asp-tags" >asp_tags</A > configuration directive is enabled, it behaves the same with <VAR CLASS="literal" >// %></VAR >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="language.basic-syntax.instruction-separation.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Acasã</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="language.types.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Instruction separation</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="language.basic-syntax.html" ACCESSKEY="U" >Sus</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Types</TD ></TR ></TABLE ></DIV ></BODY ></HTML >