You can use continue to skip the current iteration of a loop. $exclude = array(3, 4, 8, 19); for ($i=1; ...
stackoverflow.com