Constants hold values that never change during the script. Define them with define() or const and write them in UPPERCASE by convention. Use constants for things like database names, API base URLs, and maximum upload sizes.
Constants
Constants hold values that never change. Unlike variables, they have no $ prefix.
// define() — works anywhere
define("MAX_SIZE", 100);
define("SITE_URL", "https://example.com");
// const — cleaner, works at class/global scope
const PI = 3.14159;
const APP_NAME = "MyApp";
echo MAX_SIZE; // 100
echo PI; // 3.14159
// PHP built-in constants
echo PHP_VERSION; // 8.x.x
echo PHP_EOL; // newline
echo PHP_INT_MAX; // largest int
echo __FILE__; // current file path
echo __LINE__; // current line number