Hello, can someone explain this code?

I came across this code but I don’t quite understand it, can someone explain it step by step?

<?php foreach ($pagination->range(3) as $r): ?>
    <li>
        <a<?= $pagination->page() === $r ? ' aria-current="page"' : '' ?> href="<?= $pagination->pageURL($r) ?>">
            <?= $r ?>
            </a>
    </li>
 <?php endforeach ?>