Thursday, July 25, 2013

How do you define a constant?

In this section, I will explain how to define a constant in PHP.

define("Test","Hello Rajesh Shewale! How are you today?");

The constant() function returns the value of a constant. 
Syntax:
constant(constant);

Example:


//define a constant
define("Test","Hello Rajesh Shewale! How are you today?"); 


echo constant("Test");
?>