Foreach loop to get key & value from array