ScotlandPHP 2019


Please answer this simple SPAM challenge: four minus three?
(Example: nine)

The Note You're Voting On

dnhuff at acm dot org
10 years ago
This is discussed before (below) but bears repeating:

$a = null; ($a =& null; does not parse) is NOT the same as unset($a);

$a = null; replaces the value at the destination of $a with the null value;

If you chose to use a convention like $NULL = NULL;

THEN, you could say $a =& $NULL to break any previous reference assignment to $a (setting it of course to $NULL), which could still get you into trouble if you forgot and then said $a = '5'. Now $NULL would be '5'.

Moral: use unset when it is called for.

<< Back to user notes page

To Top