PHP syntax: comments

Contributor Icon Contributed by qmchenry Date Icon December 28, 2003  
Tag Icon Tagged: PHP programming

PHP allows three forms of comments all of which may seem familiar to programmers of other languages.



/* comment block
everything within the slash-asterisk
pairs is commented */

Two inline comment styles cause everything following to be ignored:

$var++; // increment var
$var=2; # another comment

Comments don’t work when they are in quotes (otherwise we couldn’t use a # in the output of an echo statement).

Previous recipe | Next recipe |
 
blog comments powered by Disqus