PHP Constant

Last Updated: August 28, 2021

A constant is a variable except that once it is defined they cannot be changed or undefined.


define(name, value, case-insensitive)


  • name: You can specify the name of the constant
  • value: You can specify the value of the constant
  • case-insensitive: You can specify whether the constant name should be case-insensitive. Default is false (case sensitive)

Define value of Pi  ( π ) in math :

define("PI", "3.14");
echo PI;