PHP Programing language

Which type adding Comment in PHP Code
Previous Home Next

Like virtually every other programming language, you can comment your PHP code. Comments are those human-readable annotation that you add to make your code more readable, and they're ignored by PHP. Comments are important to add to your PHP if that PHP code is extensive.

There are three types of comments in PHP:

The first type of comment lets you create multiline comments, which start with /*and ends with*/ , this way;

<
<?php
/*Begin by displaying a message explaining what were doing to the user */
echo "WELCOME TO PHP" ;
?>

That's great if you have a substantial comment that will take multiple lines to display. One thing that drives PHP crazy is nesting comments, however, so don't do something like this:

<?php
/*Begin by displaying an 
/*ENGLISH */
message explaining what weare doing to the user */
echo "WELCOME TO PHP" ;
?>

In PHP the other type comments are one-line comments. These types of comments only last for one line, not like multiline these type of comment is a single-line comment starts with //:

 

<?php
//Display a welcoming message.
echo "Welcome to PHP. " ;
?>
//if the using of second type of single-line comment 
works the same way, it's starts with a # sigh instead:
<?php
//Display a Welcoming message.
#display a welcoming message.
echo "Welcome to PHP." ;
?>

In other type comment in PHP like this :

<?php
######################################################
#if the using of second type of single-line comment  #
#worksthe same way,it's starts with a # sigh instead:#
######################################################
echo "Welcome to PHP." ;
?>
Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: