I am wondering if there is a difference between the two lines of code below:
protected $var = null;
protected $var;
I have seen both being used, and am wondering if it is just a matter of preference, (aka $var; initializes the variables to null anyway) or if there is actually a tangible difference between the two?
Same thing. It’s merely a stylistic difference.
From http://php.net/manual/en/language.types.null.php:
A variable is considered to be null if:
it has been assigned the constant NULL.
it has not been set to any value yet.
it has been unset().