Best Answer

There are many ways to comment in PHP, all of them valid:


Classic C style, which allows you to comment blocks rather than single lines


// C++ Style, which remarks the remainder of a single line

# bash style, which also is a rest-of-the-line comment

User Avatar

Wiki User

โˆ™ 13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is a correct way to add a comment in PHP?
Write your answer...
Still have questions?
magnify glass
Related questions

What is the correct way to add comment in PHP?

// For single line comments /* Your comments here */ For multi-line comments

What are the correct and the most two common way to start and finish a PHP block of code?

`<?php` then a `?>` and also `<?=` and `?>` are the only compliant methods now that PHP 7 is out.

What is the correct way to include the file?

<?php include_once('<path_to_file>/'); ?>

What is the correct way to add 1 to the count variable in php?

There are several ways to increment a variable:$count = $count +1;$count += 1;$count++;++$count;

The correct way to write Hello World in PHP is?

echo("hello world");

What is the correct way to include the file

<?php include_once('<path_to_file>/'); ?>

Write down a PHP code to add a session variable?

The preferred way is to simply alter the session superglobal. <?php $_SESSION['variable'] = "value"; ?>

How can you put PHP into your product details pages?

<?php // your php code goes here ?> If your product pages are created in PHP (have the .php extension) then you can simply add the php start/end tag. There is a way to have the server recognize PHP inside of HTML files but that would require some work on the server, better left to the server manager.

What is the correct way to add the suffix hood to the word likely?

The correct way to add the suffix "hood" to the word "likely" is to drop the "y" and add the suffix, resulting in "likeliness."

What is php extension?

We can write php extension is many way... .php , .php5, .php4

What is the correct way to end a PHP statement?

Each statement is ended with a semicolon. PHP is derived from C, so a lot of the components are very similar, including this. Google doesn't seem to care about these but for user's sake, for the sake of community and as a good practice, it is best to redirect and redirection should be 301.

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

function myFunction($parameter1, $parameter2) { // this function's code goes here return $returnValue; // the value returned }