PHP define() Function Last Updated : 18 Jun, 2022 Comments Improve Suggest changes Like Article Like Report The define() function is basically used by programmers to create constant. Constants in PHP are very similar to variables and the only difference between both are the values of constants can not be changed once it is set in a program. define() returns a Boolean value. It will return TRUE on success and FALSE on failure of the expression. Syntax: define(string $constant, mixed $value, bool $case_insensitive); Parameters: $constant: It is of String type that describes the name of the constant and is a required parameter. $value: It is of mixed type and it describes the Value of the constant and is required in parameter$case_insensitive: It is of a boolean type that describes whether the name of the constant can be case-sensitive or not and it is an optional parameter. Return Value: This method returns a boolean value TRUE on success and FALSE on the failure of the expression. Example 1: In this example, we have created a constant namely GREETINGS and its value is Hello GFG and the name of the constant is case-insensitive by using define() function. PHP <?php define("GREETINGS", "Hello GFG.", true); echo GREETINGS; ?> OutputHello GFG. Example 2: In the below example, we have created a constant named as LANGUAGES which consist of an array as it's value and the name of the constant is case-sensitive. PHP <?php define('LANGUAGES', array( 'C', 'C++', 'JAVA', 'PYTHON' )); echo LANGUAGES[3]; ?> OutputPYTHON Reference: https://www.php.net/manual/en/function.define.php Comment More infoAdvertise with us Next Article PHP define() Function talktoosaurabh Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Misc-Function Similar Reads PHP end() Function The end() function is an inbuilt function in PHP and is used to find the last element of the given array. The end() function changes the internal pointer of an array to point to the last element and returns the value of the last element.Syntax:end($array)Parameters:This function accepts a single par 2 min read PHP | exit( ) Function The exit() function in PHP is an inbuilt function which is used to output a message and terminate the current script. The exit() function only terminates the execution of the script. The shutdown functions and object destructors will always be executed even if exit() function is called. The message 2 min read PHP ereg() Function The Ereg() function in PHP searches a string to match the regular expression given in the pattern. The function is case-sensitive. This function has been deprecated in PHP 5.3.0 and removed in PHP 7.0.0. Syntax: int ereg ( string $pattern , string $str, array &$arr ); Parameters: pattern: It is 2 min read PHP fdiv() Function The fdiv() is an inbuilt PHP function that returns the result of a division of 2 numbers(in accordance with IEEE 754). The NaN will never == or === for any value while doing the comparison, even including itself. Syntax: fdiv(float $num1, float $num2): floatParameters: This function accepts 2 parame 1 min read PHP | ftell( ) Function The ftell() function in PHP is an inbuilt function which is used to return the current position in an open file. The file is sent as a parameter to the ftell() function and it returns the current file pointer position on success, or FALSE on failure.Syntax:Â Â ftell( $file ) Parameters Used: The ftel 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 PHP fscanf() Function The fscanf() function is an inbuilt function in PHP that parses the file's input according to format, i.e., it accepts the input from a file that is associated with the stream & the input will be interpreted according to the specified format. This function is similar to sscanf() function. Any wh 2 min read PHP eval() Function PHP eval() function in PHP is an inbuilt function that evaluates a string as PHP code. Syntax: eval( $string ) Parameters: This function accepts a single parameter as shown in the above syntax and described below. $string: It must consist of a valid PHP code to be evaluated but should not contain op 2 min read PHP each() Function The each() function is an inbuilt function in PHP and is used to get the current element key-value pair of the given array to which the internal pointer is currently pointing. After returning the key and value of the current element the internal pointer is incremented by one in the array. Note: You 2 min read PHP | each() Function The each() function is an inbuilt function in PHP which basically returns an array with four elements, two elements (1 and Value) for the element value, and two elements (0 and Key) for the element key and moves the cursor forward. Syntax: each(array) Parameters: Array: It specifies the array which 2 min read Like