note 52651 added to language.basic-syntax.comments
| From: | MSpreij at osu1 dot php dot net | Date: | Sun, 08 May 2005 19:15:39 +0000 |
| Subject: | note 52651 added to language.basic-syntax.comments | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-89126@lists.php.net to get a copy of this message | ||
A nice way to toggle the commenting of blocks of code can be done by mixing the two comment styles:
<?php
//*
if ($foo) {
echo $bar;
}
// */
sort($morecode);
?>
Now by taking out one / on the first line..
<?php
/*
if ($foo) {
echo $bar;
}
// */
sort($morecode);
?>
..the block is suddenly commented out.
This works because a /* .. */ overrides //. You can even "flip" two blocks, like this:
<?php
//*
if ($foo) {
echo $bar;
}
/*/
if ($bar) {
echo $foo;
}
// */
?>
vs
<?php
/*
if ($foo) {
echo $bar;
}
/*/
if ($bar) {
echo $foo;
}
// */
?>
----
Manual Page -- http://www.php.net/manual/en/language.basic-syntax.comments.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52651
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52651&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52651&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52651&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52651&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52651&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52651&report=yes
Search -- http://master.php.net/manage/user-notes.php