PHP Constants

constant

A constant is a name/identifier for a simple value. The constant value can not able to change during the time of script execution.

The constants are defined using define() function.

It will return either constant value of NULL.

Two types of constants are there. They are,

  • Case-sensitive constants
  • Case-insensitive constants

Case-sensitive

<?php
define("MAX_SIZE","100");
echo MAX_SIZE;
?>

Output:
100

Case-insensitive

<?php
define("MAX_SIZE","100",true);
echo max_size;
?>

Output:
100