PHP Constants
Constants are similar to variables, but once they are defined, they cannot be changed or undefined.
Constants are defined using the define()
function.
Constants वेरिएबल्स के जैसे होते हैं, लेकिन इन्हें एक बार डिफाइन करने के बाद बदला नहीं जा सकता या हटाया नहीं जा सकता।
Constants को define()
फंक्शन की मदद से बनाया जाता है।
Example: Defining a Constant
<?php
define("SITE_NAME", "LiveCodeProgramming");
echo SITE_NAME;
?>
Case-Insensitive Constants
By default, constants are case-sensitive. You can make them case-insensitive by passing true
as the third parameter.
केस-इनसेंसिटिव Constants
डिफ़ॉल्ट रूप से, constants केस-सेंसिटिव होते हैं। तीसरा पैरामीटर true
देने पर यह केस-इनसेंसिटिव हो सकते हैं।
Example: Case-Insensitive Constant
<?php
define("GREETING", "Hello!", true);
echo greeting;
?>