Add counter to it perhaps?
$counter = "";
foreach($array AS $variable){
$counter +=1;
// Here you will do your standard stuff you do always
if($counter == 4){ // check for right counter value
$counter = ""; // null the counter again
// HERE you can do stuff that only happens every 4th iteration
}
// HERE you can carry on with your usual stuff that happens always
}
Of course there are many different ways to do this, this is in my eyes the simples one.