Google News
logo
PHP Program to Case-sensitive constant name
In PHP, constant names are case-sensitive.

Here's an example :
Program :
<?php
define("GREETING", "Hello, world!");

echo GREETING . "<br>";  // outputs "Hello, world!"
echo greeting . "<br>";  // outputs an undefined constant notice and "greeting" string
?>
Output :
Hello, world!
greeting
In this example, the `define()` function is used to define a constant named `GREETING` with the value `"Hello, world!"`.

The first `echo` statement outputs the value of the constant `GREETING` using the correct case. It will output the string "Hello, world!".

The second `echo` statement attempts to output the value of the constant `greeting` using an incorrect case. Since the constant `greeting` has not been defined, PHP will output an "undefined constant" notice and the string "greeting".

It's important to note that defining constants with different cases will create separate constants. For example, `define("GREETING", "Hello, world!");` and `define("greeting", "Hi, there!");` will define two separate constants with different values.