Searching...
Saturday 15 September 2012

PHP Constant Variable - Manual

8:27 pm

PHP Constant Variable


1.       A variable whose value cannot be change or that cannot be assigned is known as a constant variable.
2.       Constant variable are created in php using the define();
Define(string constantname , value);
3.       A variable should not start with $ sign symbol and constant variable is normally defined in capital letters.
4.       PHP_OS is a predefined constant of php used for getting the name of the operating system in which current php installation is done.
5.       Phpinfo() is a built-in function of php used for getting the complete system configuration of details of php and the related products.
6.       “const” is a keyword of php used for declaring a constant variable.
Const name = “India”;
User defined and predefined constants :
<?php
Define(“name” , “India”);
Define(“age” , 25);
Const name=”IBM”;
Echo name=.”—“.age.”<br>”;
Echo PHP_OS.”<br>”;
Phpinfo();
?>

1 comments: