Articles → PHP → Constants In PHP

Constants In PHP






Software Requirement




  1. XAMPP is installed on your machine
  2. 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);


  1. First parameter is the name of the constant
  2. Second parameter is the value of the constant
  3. 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
?>





Posted By  -  Karan Gupta
 
Posted On  -  Monday, September 8, 2014

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250