The difference between define and defined in PHP the difference between define and defined in PHP will confuse the two functions for beginners? 1. define is used to define a constant. constants are also within the global range. You can access constants anywhere in the script without specifying the scope. Once a constant is defined, it cannot be changed or undefined, for example, the difference between define and defined in define (website, www.phperz.com) www. PHP
Difference between define and defined in PHP
These two functions will be obfuscated for beginners.
?
1. define is used to define a constant. constants are also within the global range. You can access constants anywhere in the script without specifying the scope. Once a constant is defined, it cannot be changed or undefined. for example, define ("website", "www.phperz.com") www.phperz.com is the constant website value.
?
2. defined is used to check whether a constant is defined. if a constant exists, true is returned. otherwise, false is returned, for example, if (defined ("website") {echo "true ";} else {echo "false ";}