How Do You Comment out a Line in PHP?

Problem scenario
You want to try some .php scripts or web pages without certain lines of code.  How do you comment out an individual line?

Use this at the beginning of a line of code: //

Example:  //this text will do nothing in the .php script

To comment out multiple lines, use this at the beginning of the first line: /*
Then conclude the multi-line comment with this:  */


   echo "                                                       ";
   $db = pg_connect( "$host $port $dbname $credentials"  );
      echo "Error : Unable to open database\n";
   } else {

EVERYTHING between the first forward slash and asterisk and the second asterisk and forward slash have been commented out.


Leave a comment

Your email address will not be published. Required fields are marked *