Beginner question...
How different is define("$a",365);
from $a = 365;
?
Thanks!
JDelage
If you define constant define("YEAR",365);
you can't change it during execution time so YEAR will always be 365 no meter what. On the other hand variables can change their value during script execution also they have local scope, which means they are available just in the function file they are declared. Constants have global scope they can be accessed from all over the script.
http://php.net/manual/en/language.constants.php
http://planetozh.com/blog/2006/06/php-variables-vs-constants/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With