PHP constant() Function Last Updated : 31 Dec, 2020 Comments Improve Suggest changes Like Article Like Report The constant() function returns the value of a constant. It also works with class constants. Syntax: constant(constant) Parameter Values: constant: It is a required value that specifies the value of the constant. Return Value: It returns the value of a constant if the constant is defined else returns NULL. Note: It works on PHP 4.0 or newer versions. Exceptions: If the constant is not defined, it throws an E_WARNING error. It gives a run time warning without script termination. The following are the PHP programs to show the working of the constant() function. Example 1: Case sensitive PHP <?php // Define a constant define("Home","Welcome to GeeksforGeeks"); echo constant("Home"); ?> Output: Welcome to GeeksforGeeks Example 2: Case insensitive PHP <?php // Define a case insensitive constant define("GFGConstant","True denotes case-insensitive", true); echo constant("gfgconstant"); ?> Output: True denotes case-insensitive Reference: https://www.php.net/manual/en/function.constant.php Comment More infoAdvertise with us Next Article PHP constant() Function A arorakashish0911 Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP count() Function The count() function in PHP is used to count the number of elements in an array or the countable properties of an object. The function returns an integer value representing the number of items present.Syntax:count($array, mode)In this syntax:$array (mandatory): Refers to the array, whose elements ar 3 min read PHP | fstat( ) Function The fstat() function in PHP is an inbuilt function which is used to return information about an open file. The file name is sent as a parameter to the fstat() function and it returns an array with the following elements : Numeric Associative Description 0 dev Device number 1 ino inode number* 2 mode 3 min read PHP cos( ) Function Trigonometry is an important part of mathematics and PHPâs math functions provides us with some functions which are very useful for calculations involving trigonometry. The cos()function in PHP is used to find the cosine of a number. The cos() function returns a float value between -1 and 1, which r 2 min read PHP compact() Function The compact() function is an inbuilt function in PHP and it is used to create an array using variables. This function is the opposite of the extract() function. It creates an associative array whose keys are variable names and their corresponding values are array values. Syntax: array compact("varia 2 min read PHP decoct( ) Function In the earlier days of computing, octal numbers and the octal numbering system was very popular for counting inputs and outputs because as it works in counts of eight, inputs and outputs were in counts of eight, a byte at a time. Due to a wide usage of octal number system many times it happens that 2 min read Like