Can you try this, Added $Reset
variable so every loop >10 it reset the count
<?php
$listings = explode("<hr/>", $list);
$numberOfListings = count($listings);
$Reset =1;
for($i = 0; $i < $numberOfListings; ++$i)
{
if ($Reset == 4)
{ ?>
<some ad script runs in>
<?php } if ($Reset == 9) { ?>
<some ad script runs in>
<?php }
echo $listings[$i] . "<hr/>";
if($Reset>10){
$Reset =1;
}
$Reset++;
}
?>