We need spaces here as well. I must have missed this earlier myself. ;) Spaces on either side of the array key if it is a varialbe '$types[ $i ]'