Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

PHP Multiline Comments

Multi-line Comments

Multi-line comments begin with /* and end with */.

Any text between /* and */ will be ignored.

The following example demonstrates a multi-line comment for explanation:

Example

Multi-line comment for explanation:

/*
The next statement will
print a welcome message
*/
echo "Welcome Home!";

Multi-line Comments to Ignore Code

We can use multi-line comments to prevent entire blocks of code from being executed.

Example

Multi-line comment to exclude code:

/*
echo "Welcome to my home!";
echo "Mi casa su casa!";
*/
echo "Hello!";

Comments in the Middle of the Code

The multi-line comment syntax can also be used to prevent the execution of parts within a line of code.

Example

The +15 portion will be ignored in the calculation.

$x = 5 /* + 15 */ + 5;
echo $x;