Create a constant with a case-sensitive name:
define("GREETING", "Welcome to W3Schools.com!");
echo GREETING;
?>
--------
Create a constant with a case-insensitive name:
define("GREETING", "Welcome to W3Schools.com!", true);
echo greeting;
?>
---------
Create an Array constant:
define("cars", [
"Alfa Romeo",
"BMW",
"Toyota"
]);
echo cars[0];
?>
--------
This example uses a constant inside a function, even if it is defined outside the function:
define("GREETING", "Welcome to W3Schools.com!");
function myTest() {
echo GREETING;
}
myTest();
?>
--------
--------
0 Comments
Good day precious one, We love you more than anything.