Fish Wang says to YSITD
http://php.net/manual/en/control-structures.foreach.php Warning Reference of a $value and the last array element remain even after the foreach loop. It is recommended to destroy it by unset(). Otherwise you will experience the following behavior: