I did a search for this, but I could not find an answer to my question.
When a variable is declared without a value, like this:
$var;
public $aVar;
Is the value of the variable unknown, as in many languages (i.e. whatever was in memory before), or is the variable by default set to null?
Variables that are declared without a value and undefined/undeclared variables are
nullby default.However, just doing
$var;will not declare a variable so you can only declare a variable without a value in an object.Demo:
Output: