I wanted to echo an image every after 3 post via XML here is my code :
Use the modulo arithmetic operation found here in the PHP manual.
e.g.
$x = 3; for($i=0; $i<10; $i++) { if($i % $x == 0) { // display image } }
For a more detailed understanding of modulus calculations, click here.