PHP Multiple choices


Total available count: 47
Subject - PHP Frameworks
Subsubject - PHP

What is the correct way to add a comment in PHP?


 

 

 

 



D


Solution:-

PHP comment
Single line comment used for quick notes about complex code or to temporarily disable a line of PHP code. You need to add // or # before the code.
Multi-line comments used to comment out large blocks of code or writing multiple line comments. You need to add /* before and */ after the code.

PHP supports several ways of commenting, examples are as follows:

Example Syntax for single-line comments:

<!DOCTYPE html>
<html>
<body>

<?php
// This is a Slight Book single-line comment

# This is also a Slight Book single-line comment
?>

</body>
</html>

Example Syntax for multiple-line comments:

<!DOCTYPE html>
<html>
<body>

<?php
/*
This is a multiple-line comment block
that spans over multiple
Slight Book lines
*/
?>

</body>
</html>

Example of Using comments to leave out parts of the code:

<!DOCTYPE html>
<html>
<body>

<?php
// You can also use comments to leave out parts of a Slight Book code line
$x = 10 /* + 25 */ + 10;
echo $x;
?>

</body>
</html>

 




Next 5 multiple choice(s)

1

What is the correct way to add 1 to the $count variable?

2

Which superglobal variable holds information about headers, paths, and script locations?

3

PHP allows you to send emails directly from a script

4

What is the correct way to open the file "time.txt" as readable?

5

What is the correct way to create a function in PHP?

Comments