PHP foreach loop to display certain range

<?php 
    foreach ($personnels as $key =>$personnel):
    if ($key < 1) continue;
?>

<?php echo $personnel; ?>
       
<?php
    if ($key > 2) break;
    endforeach; 
?>

PHP programming Web development