Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP define() Function

PHP define() Function

PHP Misc Reference Manual PHP Misc Reference Manual

Example

Define a case-sensitive constant:

Run Example »


Definition and Usage

The define() function defines a constant.

Constants are similar to variables, except that:


Syntax

define(

name,value,case_insensitive

)

Parameters Description
name Required. Specifies the name of the constant.
value Required. Specifies the value of the constant. PHP 7 supports arrays, as shown below:

echo ANIMALS[1]; // outputs "cat" ?> | | case_insensitive | Optional. Specifies whether the constant name is case-sensitive. Possible values:

|

Technical Details

Return Value: Returns TRUE on success, FALSE on failure.
PHP Version: 4+

More examples

Example

Define a case-insensitive constant:

Run Example »


PHP Misc Reference Manual PHP Misc Reference Manual