Comments

Commenting and documenting code is so important to make life easier later on when you return to your code and wonder why you did something specific.

All comments are started with two forward slashes // which will work on one line only.
Multiple line comments are better with /* at the start and */ at the end.
Also # will comment out anything after it as well, on one line only.

So back to our Hello World page from the previous thread. <html>
<head>
<title>Hello World Practice</title>
</head>
<body>
<?php
// line to print Hello World - a comment
print "Hello World";
/* this is another comment and it doesn't matter
what goes where so long as I finish the comment
at the end of this
print "Hello Again"; - this won't display
it's part of the comment
*/
?>

</body>
</html>

You may also like...

Leave a Reply

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