Multiple line comment inside multiple line comment in PHP

Viewed 31251
<?php
/*
    /* this is a comment */
*/
?>

PHP returns "syntax error"... Is this just a completely wrong way to use multiple line comment?

Sometimes I need to comment out a big block of code for testing, and this block contains hundreds of lines and there are many multiple line comments inside.

What's the best way to comment out this big block? Besides removing it temporarily from the file?

6 Answers

Quick solution for the nested comment:

Turn the closing */ into a * /

In other words: Just set one whitespace.

For a smart move, just add and save your whole desired comment code section in "yourCodeBlock.php" and then:

<?php
/*
include("yourCodeBlock.php");
*/
?>

or a simple single line comment

<?php
//include("yourCodeBlock.php");
?>
Related