Beware! This is a subtle problem that can have serious consequences for the operation of your PHP code. If you do not explicitly assign at least one value to a new array (or an array that you are going to use anew in loop, say) or set it to be empty, then it will either have undefined contents (or it will contain values that were previously assigned to it in a previous loop).
If you have any doubt that you are immediately going to assign defined values to the array (or even if you don’t), you must specifically clear the array like this:
$my_undefined_array = array();
image credit: Vincent Pontier – http://www.elroubio.net/elephpant_download.php http://php.net/elephpant.php, GPL, https://commons.wikimedia.org/w/index.php?curid=48337261