Note that using key($ array) in a foreach loop may have unexpected results. When requiring the key inside ...
php.net