Adding comments in PHP

Adding comments to code is important – it helps you read it at a later stage. You can navigate code and see exactly what it’s doing thanks to the comments.

Code Example
<!DOCTYPE html>
<html>
<body>

<?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
*/

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

</body>
</html>

Code Flavour is a news site with a focus on coding. Our aim is deliver news over a range of categories which will be insightful and beneficial to readers that are interesting in code development.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *