Monday, 22 June 2015

How To create Constant in PHP ?

Constants are like variables except that once they are defined they cannot be changed or undefined.


<?php

//The example below creates a constant with a case-sensitive name

define("PI", 3.14);

echo PI;


//The example below creates a constant with a case-insensitive name

define("PI", 3.14,true);

echo pi;

?>

No comments:

Post a Comment