3. PHP – Constants and Comments


Constants :

Constants as the name indicates, as they are defined they cannot be changed during the script. A constant is an identifier. A valid constant starts with a letter of underscore, and are automatically global across the script. To set a constant, we use the function, define(). For an instance :

define (“constnt”,”This is a constant and cannot be changed”);
echo constnt;

Comments :

PHP supports three different types of comments.

  • Multi-line comment as in C.
  • Single-line comment (//) as in C and C++.
  • Single-line comment (#) as in Perl.

Here is the code to demonstrate the above :

View original post


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s