Concept

How does PHP handle undefined variables, null values, and constants?

ComputerScienceOne / Using Variables

"If you do not assign a value to a variable, that variable remains undefined or “unset.” Undefined variables are treated as null in PHP. The concept of “null” refers to uninitialized, undefined, empty, missing, or meaningless values. In PHP the keyword null is used which is case insensitive ( null , Null and NULL are all the same), but for consistency, we’ll use null . When null values are used in arithmetic expressions, null is treated as zero. So, (10 + null) is equal to 10. When null is used in the context of strings, it is treated as an empty string and ignored. When used in a Boolean expression or conditional, null is treated as false . PHP also allows you to define constants : values that cannot be changed once set. To define a constant, you invoke a function named define and providing a name and value."

Related Ideas

How does PHP handle undefined variables, null values, and constants? | ComputerScienceOne | Bifalgorithm | Bifalgorithm