define() function in PHP

PHPProgrammingServer Side Programming

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.

 Live Demo

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

Ouptut

The following is the output.

This is it!
raja
Published on 04-Dec-2018 14:38:37
Advertisements