in ,

PHP Comments

PHP Comments
PHP Comments

In this tutorial, you will learn about PHP Comments step by step. So without much to do, let’s get started.


Buttons Previous Next

In this article, you will learn-

What is PHP?

• PHP is an acronym for “PHP: Hypertext Preprocessor”
• PHP is a widely-used, open source scripting language
• PHP scripts are executed on the server
• PHP is free to download and use

PHP is an amazing and popular language!
It is strong enough to be on the center of the biggest blogging system on the web (WordPress)!
It is deep enough to run large social networks!
It is also easy enough to be a beginner's first server side language!

PHP Comments

PHP comments can be used to describe any line of code so that different developer can understand the code effortlessly. It can also be used to hide any code.

PHP helps single line and multi line comments. These comments are just like C/C++ and Perl style (Unix shell style) comments.

Comments in PHP

A comment in PHP code is a line that isn’t executed as a part of the program. Its simplest reason is to be read by someone who’s looking at the code.

Comments can used to:

• Let others understand your code
• Remind yourself of what you probably did – Most programmers have skilled coming back to their own work a year or two later and having to re-figure out what they did. Comments can remind you of what you were questioning whilst you wrote the code

PHP supports several approaches of commenting:

Example
Syntax for single-line comments:

<!DOCTYPE html>
<html>
<body>
 
<?php
// This is a single-line comment

# This is also a single-line comment
?>
 
</body>
</html>

Example
Syntax for multiple-line comments:

<!DOCTYPE html>
<html>
<body>
 
<?php
/*
This is a multiple-lines comment block
that spans over multiple
lines
*/
?>
 
</body>
</html>

Example
Using comments to leave out parts of the code:

<!DOCTYPE html>
<html>
<body>
 
<?php
// You can also use comments to leave out parts of a code line
$x = 5 /* + 15 */ + 5;
echo $x;
?>
 
</body>
</html>

READ NEXT

PHP Installation

PHP Syntax

This is about PHP Comments, and we hope you have learned something from this tutorial and share your opinion about this tutorial. What do you think about it, and if you think this tutorial will help some of your friends, do share it with them.



salman khan

Written by worldofitech

Leave a Reply

PHP Syntax

PHP Syntax

Ethereum - MyEtherWallet

Ethereum – MyEtherWallet