Using Constants in PHP

Site Name: MyWebsite

Max Users: 100

Explanation

In PHP, a constant is a name or an identifier for a simple value. A constant's value cannot be changed during the script execution. Constants are defined using the define() function and are globally accessible. Unlike variables, constants do not use the dollar sign ($) before their name. This immutability ensures that the value remains constant throughout the script.

Source Code

<?php
// Defining constants
define("SITE_NAME", "MyWebsite");
define("MAX_USERS", 100);

// Using constants
echo "<p>Site Name: " . SITE_NAME . "</p>";
echo "<p>Max Users: " . MAX_USERS . "</p>";
?>