PHP Constant :– A PHP constant is a value which can not be changed during the program execution.An many programming languages,the only difference comes when we declare it in php.
So many people get confused in variable and a constant programatically when we use these two terms in php. So only the difference is a variable name might get changed but a constant can not during the script execution.
PHP Constant | Decleration
To declare and initialising a constant following syntax works for php==>>>define(constant_name, value, case_sensitive=true);
Example
<?php $_name="sachin"; $_name="harish";//it works well as you can change variable value define("webtechnology","javascript",false); define("webtechnology","html",false);// error saying webtechnology is already defined on line 13. echo webtechnology; echo $_name; ??> |