constant in PHP

Syntax of constant in PHP

mixed constant(string name)

Returns the value of the constant called name.

Example of constant

<?php

// Valid constant names
define("FOO",     "something");
define("FOO2",    "something else");
define("FOO_BAR", "something more");

// Invalid constant names
define("2FOO",    "something");

// This is valid, but should be avoided:
// PHP may one day provide a magical constant
// that will break your script
define("__FOO__", "something"); 

?>

Leave a Comment