Site icon T4Tutorials.com

Single Line and Multi-Line Comments in PHP,  HTML, CSS, and JavaScript

Single Line and Multi-Line Comments in PHP,  HTML, CSS, and JavaScript

Let’s start with the tutorial of Single Line and Multi-Line Comments in PHP, HTML, CSS, and JavaScript”.

Single-Line  Comment in PHP

Let’s see the “Single-Line  Comment in PHP”.

<?php 
// This is a single line comment in PHP.
?>

Multi-Line  Comment in PHP

Let’s see the “Multi-Line  Comment in PHP”.

<?php
/*
This is Multi-line - Line 1 Comment
This is Multi-line - Line 2 Comment 
*/
echo “I am super awesome!”;
?>

Comments in HTML

Let’s see the “Comments in HTML”.

<html>
<head>
<title>This is Multi line Comment</title>
</head>
<body>
<!--
This is Multi-line - Line 1 Comment
This is Multi-line - Line 2 Comment
This is Multi-line - Line 3 Comment
-->
</body>
</html>

Comments in CSS

Let’s see “Comments in CSS”.

body {
  font-size: 32px;
  width:30px;
  height:90px;  
  /* 
  CSS Comments
  */
}

Single line comments in JavaScript

Let’s see the “Single line comments in JavaScript”.

<script>
var a = 5;    // Declare x, give it the value of 5
var b = a + 2;  // Declare y, give it the value of x + 2 
// Write y to demo:
document.getElementById("demo").innerHTML = y;
</script>

Multi-Line Comments in JavaScript

Let’s see the “Multi-line comments in JavaScript”.

/*
This is multi-line comment - Line 1
This is multi-line comment - Line 2
*/
document.getElementById("t4tutorials").innerHTML = "Welcome to first page.";
document.getElementById("t4tutorials").innerHTML = "Welcome to 2nd page.";
Exit mobile version