single line comment php code example

Example 1: php comment

// This is a single-line comment

# This is also a single-line comment

/*
This is a multiple-lines comment block
that spans over multiple
lines
*/

Example 2: how to make a comment in php

// single line comment
/* multi line comment
hello
*/

Example 3: comment php

// This is a single-line comment
# This is also a single-line comment
/*
This is a multiple-lines comment block
that spans over multiple
lines
*/

Example 4: comment in php

Comments in PHP can be used for several purposes, a very interesting one being that you can generate API documentation directly from them by using PHPDocumentor (http://www.phpdoc.org/).

Therefor one has to use a JavaDoc-like comment syntax (conforms to the DocBook DTD), example:
<?php
/**
* The second * here opens the DocBook commentblock, which could later on<br>
* in your development cycle save you a lot of time by preventing you having to rewrite<br>
* major documentation parts to generate some usable form of documentation.
*/
?>
Some basic html-like formatting is supported with this (ie <br> tags) to create something of a layout.

Example 5: comments in php

//For a single line comment use //:
//this is a comment too
//for multi-line comments use /* and */:
/* <--start of multi-line comment
this is a comment

this is a comment too (end of multi-line comment)-->*/

Example 6: php comment

// I'm a single, line comment 
#  I am another single line comments using #
/*
 And I am a 
 multiline comment
*/

Tags:

Php Example