<?php $i = 0; $reklam = [1,5,9]; while($i<10) { if ( in_array($i,$reklam) ): ?> reklam <?php endif; echo $i."<br>"; $i++; }