Commenting Out Code

PHP

Comments are done via two forward slashes //

Ex:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p> This is regular HTML</p>
<?php echo '<p>This is HTML via <strong>PHP!!</strong></p>';

//this is a comment. It is NOT seen at all

?>

</body>
</html>

See hello.php for how it actually works


PERL

Comments are done with a pound sign

# This is a single line comment
# The same comment symbol is used for multiple lines as well
# (e.g. If you want multiple lines commented out, use the # sign on each line)


JavaScript

// This is a JavaScript Comment, just like PHP comments

/*

This is a much longer JavaScript Comment
It spans TWO lines
or THREE lines (just like CSS Comments)

*/


HTML

Done via a wicket < , a bang !, and two dashs --, then closed with two dashs -- and a close wicket >

Ex:

<p> This will show up on screen</p>

<!-- This will not-->


CSS

Done with a slash / followed by an asterisk * : ends with the asterisk * followed by the forward slash /

/* Commented out code here */

Ex.
h1, h2, h3, h4 {
color: red;
/* font-variant: small-caps; */
font-family: "Comic Sans MS", "Bookshelf Symbol 7";
size:1.3em;
}


Microsoft SQL Server

Comments are done in two different ways

//This is a single line comment (done by two forward slashes (//))

//To continue onto another line, you need to put the comment symbol in again

For a multiline comment, use the forward slash followed by an asterisk (/*), then end it in reverse (*/)

/* This is a
multiline comment that
continues onto more than one line */

This is just like CSS comments

Back to Class Tips

Back to Home