in reply to If Not Replace
is reallyif (!$myarray[$arrayKey[$i]]) { $myarray[$arrayKey[$i]]=() }
if (!$myarray[$arrayKey[$i]]) { $myarray[$arrayKey[$i]] = undef; }
If $myarray[$arrayKey[$i]] is non-existent, 0, the empty string, "0" or one of the few other things that are false, undef will be assigned to it.
Unless you are trying to micro-optimise memory usage (undef takes less memory than the string "0"), it sounds like a rather useless thing to do.
Maybe the author was trying to stretch the size of the array, but that's probably a useless thing to do too. As the statement demonstrates, using and assigning to non-existent elements is not a problem.
|
|---|