This is just a quick trick I have used. Specially in long
The idea is mixing single and multiline comments for easier handling.
--Single line comment.
/*Multiline comment opening.
*/Multiline comment closing.
Take this simple SQL operation.
SELECT * FROM users;
Now let's use both single and multiline comments.
--/* SELECT * FROM users; --*/
The operation will be the same, but if we delete the single line comment
-- before the multiline opening
/*, then the operation will be commented out. The
--*/ will be interpreted as the end of the multiline comment if multiline is enabled or just a regular comment otherwise, so we do not need to touch it.
This have the following advantage, just need to delete or add the single line
-- once, and a whole block of code will be (un)commented out.
/* SELECT * FROM users; --*/
This technique can be used in any programming language that supports single and multiline comments.
<?php // /* echo "Hello"; // */ my_not_commented_out_function();
<?php /* echo "Hello"; // */ my_not_commented_out_function();