The answers above are great, especially the comment that "An important difference between both methods is that unset($a) also removes $a from the symbol table".
However, I don't think anyone has really fully answered the question in a practical sense because they don't describe how the two are used. OK I think we know that they both basically do the same thing. Why use one over the other?
null
Reclaims memory immediately (at the expense taking longer) despite PHP self managing memory /garbage collection.
unset()
Is usually recommended as it reclaims memory "when I can get to it" and is therefore considered faster as it doesn't dedicate resources immediately to it.
When should use null vs unset?
Basic (small data) data arrays etc. are good candidates for unset because memory won't become an issue. Larger data sets and/or anywhere the need to reclaim memory immediately is better for null. For example such large database requests can cannibalize your PHP memory ceiling very quickly if called multiple times in a function etc. which will cause page 500 errors from memory being full etc.. Therefore, unset should be preferred when speed is important (or in general) and when there is little concern for memory build up.
Example: Taking a large array and placing it into MemCache:
list($inv1, $inv2, $inv3, $inv4) = array_chunk($inventory_array),
ceil(count($val['inventory']) / 4));
MemCache::set($cacheKeyInv1, $inv1, $expiry);
MemCache::set($cacheKeyInv2, $inv2, $expiry);
MemCache::set($cacheKeyInv3, $inv3, $expiry);
MemCache::set($cacheKeyInv4, $inv4, $expiry);
for ($i = 1; $i < 5; $i++) {
${"inv" . $i} = null; // why not use unset ?
}
The for loop is cleaning up the data, null or unset could be used, but since it is a large dataset, perhaps null is preferred as it will reclaim the memory quicker.