Articles → PHP → Constants In PHP
Constants In PHP
Software Requirement
- XAMPP is installed on your machine
- Any text editor like Notepad
Technical Knowledge
What Do You Mean By Constant?
Rules For Making Constant
Syntax
define(constant_name, constant_value,is_case_insensitive);
- First parameter is the name of the constant
- Second parameter is the value of the constant
- Third one is the optional parameter that specifies if the constant name is case insensitive or not. By default, the value is false which means that the constant name is case sensitive
Example
<?php
define("PIE", "3.14", true);
echo pie
?>
<?php
define("PIE", "3.14");
echo pie
?>