PHP Scripts can be placed anywhere on the page and the script always starts with <?php and ends with ?>

A Comment in PHP is a line of code that you don’t want to be read by the program. It offers a way to make your code more readable and helps a lot when someone else has to work on your code. Providing good comments in your code is a good practice.

You will also find it very useful when you have good comments in your code when you come back to your own code after a year or two. When you are working on multiple projects it can be especially useful to remind you why you added certain code.

<!DOCTYPE html>

// This is a single-line comment

# This is also a single-line comment

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

// You can also use comments to leave out parts of a code line
$x = 5 /* + 15 */ + 5;
echo $x;


Comments in PHP is also very valuable when you are testing code and want to block out certain parts of your code.