What does it mean if something is defined or undefined? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What does it mean if something is defined or undefined?

Apparently the difference between variables and constants is one cannot be undefined. What does that mean?

2nd Mar 2017, 7:24 PM
Gabriel Lebin
1 Answer
+ 2
$var = 3; // initial value of the variable $var = 5; // changing the value from 3 to 5 define("VAR", 20); // Defining Constant VAR = 30; // it's not possible !! // Once you define Constant, you cannot change its value anymore. // Changing/overwriting the value of the variable is possible. That's the difference.
2nd Mar 2017, 10:38 PM
Dev
Dev - avatar