0

What are the differences between PHP constants and variables?

24th Mar 2017, 12:51 PM
Lonimer Balino
Lonimer Balino - avatar
4 Respuestas
+ 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.
24th Mar 2017, 12:58 PM
Geoffrey L
Geoffrey L - avatar
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."
24th Mar 2017, 12:59 PM
Eranga
Eranga - avatar
0
2. You can call it without $. <?php define ("greet", "Hello world!"); echo greet; ?>
3rd Apr 2017, 9:56 AM
Emptyman
Emptyman - avatar
0
Constant variables have their values maintained and immutable throughput the entire program, but the converse is true for normal $variables
6th Jul 2020, 8:20 AM
Frederick Obeng-Nyarko
Frederick Obeng-Nyarko - avatar