Comment Switching

Just a comment block I find useful when testing.

/*
echo $query;
exit;
/*/
$run = execute_query($query);
//*/

Here there are two sections, the top section (the echo $query) is for debugging purposes when I  just want to halt the script there. The second section is the actual script to run.

I want to switch between the two, but I don’t use any fancy debugging software. Rather than continually comment out each section, I use this.

You switch between by the /*

on the first line. To activate, add a / to the front of that.

//*
echo $query;
exit;
/*/
$run = execute_query($query);
//*/

What happens is you actually create a toggle. When you have // at the start, you’re commenting out the start of the first comment, so the echo $query is no longer commented. However the second comment tag, /*/ now picks up and is a new start comment tag.
It then comments everything out until the last comment tag //*/ which is a global ender (it will be the last comment tag overall).

My syntax highlighter doesn’t exactly pick up on the comment complexity here, but it works fine in my editor.

Screenshot of the first block active.

Screenshot of the second block active.

Useful to none, interesting to me.



This entry was posted on Sunday, December 26th, 2010 at 7:32 am and is filed under Development. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
  • http://www.mutuellesmutuelle.com/mutuelle-fonctionnaire.php mutuelle fonctionnaire

    Great article, i really appreciate it