0
What are the differences between PHP constants and variables?
4 odpowiedzi
+ 2
A constant never change.
A variable will see it value change.
Of course you could code all with variables and that would works but it makes more clear when you read your code what is fix and what will change.
0
"A constant is a value that cannot be altered by the program during normal execution, i.e., the value is constant. When associated with an identifier, a constant is said to be "named," although the terms "constant" and "named constant" are often used interchangeably."
0
2. You can call it without $.
<?php
define ("greet", "Hello world!");
echo greet;
?>
0
Constant variables have their values maintained and immutable throughput the entire program, but the converse is true for normal $variables