By Team Escalera
on 31 Oct 2017 02:39 PM
  • learn php in lucknow
0 comments

Constants

Constants are like variable but they cannot be changed or undefined after they’ve been defined.
Begin the name of your constant with a letter or an underscore.
To create a constant, use the define() function: define(name, value, case-insensitive)
Parameters:
name: Specifies the name of the constant;
value: Specifies the value of the constant;
case-insensitive: Specifies whether the constant name should be case-insensitive. Default is false;

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

<?php
define(“STATUS”, “It is Live!”);
echo STATUS;

?>

// Outputs “It is Live!”

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

<?php
define(“STATUS”, “It is Live!“, true);
echo status;

?>

// Outputs “It is Live!”

Comments (0)

Leave A Comment