Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Commenting out other comments with PHP?

Tags:

comments

php

Can I comment out lines which have other comments?

/*
 * comment 1
 */

$var = 0;
$if();

/*
 * comment 2
 */
$var2 = 2;

Is there a way to comment out all these lines together? I often have a long function or logic and would like to comment out the rest for testing.

like image 880
Gershon Herczeg Avatar asked Jun 28 '12 15:06

Gershon Herczeg


1 Answers

Have you considered skipping over the code by placing it inside an if(0) block?

For example:

<?php
if( 0 ) {
     print("This code is 'commented' out");


... other commented out code is here ...


}
?>
like image 105
HeatfanJohn Avatar answered Sep 29 '22 16:09

HeatfanJohn