define()
` function with the third argument set to `true
`. This third argument tells PHP to define the constant with a case-insensitive name.<?php
define("GREETING", "Hello, world!");
define("Greeting", "Hi, there!", true);
echo GREETING . "<br>"; // outputs "Hello, world!"
echo Greeting . "<br>"; // outputs "Hi, there!"
echo greeting . "<br>"; // outputs "Hi, there!"
?>
Hello, world!
Hi, there!
Hi, there!
define()
` function is used to define two constants. The first constant, `GREETING`, is defined with a case-sensitive name and the value `"Hello, world!"`.define()
` is set to `true
`, indicating that the constant should have a case-insensitive name.echo
` statements output the values of the constants using different cases. The first `echo
` statement outputs the value of `GREETING
` using the correct case. The second `echo
` statement outputs the value of `Greeting
` using mixed case. The third `echo
` statement outputs the value of `greeting` using all lowercase letters. In all cases, the output will be "Hello, world!" for the `GREETING` constant and "Hi, there!" for the `Greeting` and `greeting` constants.