Commenting Your PHP


There are three types of comments in PHP. The first kind is similar to the one-line comments found in JavaScript, and starts with //:

 <html>     <head>         <title>             Using the echo statement         </title>     </head>     <body>         <h1>             Using the echo statement         </h1>         <?             //Send text back to the browser.             echo "Greetings from PHP.";         ?>     </body> </html>

In PHP, you can also use the # symbol in place of //:

 <html>     <head>         <title>             Using the echo statement         </title>     </head>     <body>         <h1>             Using the echo statement         </h1>         <?             #Send text back to the browser.             echo "Greetings from PHP.";         ?>     </body> </html>

You can also use multi-line comments as well. Multi-line comments start with /* and continue until a */ is encountered. Here’s an example:

 <html>       <head>           <title>               Using the echo statement           </title>       </head>       <body>           <h1>               Using the echo statement           </h1>           <?               /* This code sends the text                  "Greetings from PHP."                  back to the browser.               */               echo "Greetings from PHP.";           ?>       </body> </html>

Now it’s time to start looking at how to work with variables in PHP.



Ajax Bible
Ajax Bible
ISBN: 0470102632
EAN: 2147483647
Year: 2004
Pages: 169

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net