/** @var int[] $nums This is an array of counters */ $nums = array(0, 0, 0); foreach($nums as $num) { // i.e. here $num will be typed "int" automatically }