Computer >> Computer tutorials >  >> Programming >> PHP

define() function in PHP


The define() function defines a constant.

Syntax

define(const_name,value,case_insensitive)

Parameters

  • const_name − The name of the constant.

  • value − The value of the constant.

  • case_insensitive − The constant name should be case-insensitive.

Return

The define() function returns true on success or false on failure.

Example

The following is an example that defines a constant.

<?php
      define("message","This is it!");
   echo constant("message");
?>

Ouptut

The following is the output.

This is it!