Quick PHP block comment toggle · 18 September 2009, 11:58

Probably obvious, but I like occasionally stating said obvious, given the amounts of time other people doing the same thing has helped me.

If you want to be able to quickly comment in and out recurring blocks in your code, e.g. for testing purposes, replace your simple closing */ with a //*/, e.g.

/* $this = is_a_block($of_code);
$commented = out_for($testing); //*/

Now, to toggle the block, all you need to do is add or remove the opening /*. Without it, the closing comment ‘tag’ is still a comment, this time in-line:

$this = is_a_block($of_code);
$commented = out_for($testing); //*/

— Neike Taika-Tessaro

---

Comment

Textile Help
Categories: php, tips
Related:

Extending phpDocumentor with custom tags · 23 October 2009, 19:36

void and null function 'returns' in PHP · 22 September 2009, 16:53

PHP loose type comparison: Arrays · 18 September 2009, 13:30

Global variables in PHP · 17 October 2007, 17:35

Filter-explode · 15 October 2007, 12:43