SQL PHP HTML ASP JavaScript articles and free scripts to download
 

PHP Comments and its use inside code

Comments are used in php to not to execute a part or a line of code. Use of comments is a good practice and it helps in code maintenance for future modification and updating. By using comments we can comment or stop executing on a part of a line or in a block of code. You can read the HTML comments also. Here basic difference between html comment and php comment is in case of php comments; server never sends them to browser, where as all html comments are posted to browser but browser stops displaying them. Any one can see html comments by checking the view – source of the page. The comments are inserted in any part of the PHP code.

To comment we can use //
Or we can use #
Or we can use /*


Here is some example of use of comments in PHP code.

echo “Hello world”; // this part is commented and not displayed

//echo “This will not be displayed as commented “;

#echo “this is also commented “;

To comment more than one line or a block of code we can write like this

/* echo “ This is commented “;
echo “This is also commented “;
echo “this is also commented, so not displayed”;
*/

echo “this is displayed “;



In this type of code we must write a stop comment also like */ along with start comment like /*


Further readings
Introduction to PHP: How scripting languages work
PHP beginners guide
echo command & escape character for string outputs
Adding delay to the script execution time by using sleep function
Disabling a part of the code by using comments in PHP
Printing Numbers 1 to 50 to screen
PHP Info: Details on PHP script settings & installation at server end
PHP.ini file: PHP server configuration setting file for Edit or update
ini_get: PHP function to get configuration settings from php.ini file
ini_set: PHP function to change the configuration settings of php.ini file
PHP Version : What is the version of PHP running at the server
Installing PHP on windows server and IIS
Installing PHP5 on windows server and IIS
Setting up PHP in Windows Vista OS to run in IIS7 web server
Configuration of IIS7 to run PHP scripts with ISAPI module Extension directory of PHP to store dll files for windows

malik08-02-2010
good very good site
Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked


Join Our Email List
Email:  
For Email Newsletters you can trust
Basics
PHP Sections