Menu
Riverview Church

DEFINE

Defines a named constant

SYNTAX

define ( string $name , mixed $value ) : bool

PARAMETERS

name

The name of the constant.

Note: It is possible to define() constants with reserved or even invalid names, whose value can (only) be retrieved with constant(). However, doing so is not recommended.

value

The value of the constant. In PHP 5, value must be a scalar value (integer, float, string, boolean, or NULL). In PHP 7, array values are also accepted.

Warning: While it is possible to define resource constants, it is not recommended and may cause unpredictable behavior.

RETURN

Returns TRUE on success or FALSE on failure.

EXAMPLES

NAME VALUE | NULL

NULL

NAME VALUE | BOOLEAN

true

NAME VALUE | FLOAT

0.1

NAME VALUE | INTEGER

1

NAME VALUE | STRING

Hello World!

NAME VALUE | ARRAY

Array
(
    [0] => 0
    [1] => 1
)

RETURN

true

PHP