How can PHP tags be properly utilized in breadcrumb loops for better functionality?

To properly utilize PHP tags in breadcrumb loops for better functionality, it is important to ensure that the PHP code is correctly embedded within the HTML structure of the breadcrumbs. This can be achieved by using PHP opening and closing tags within the HTML markup to dynamically generate the breadcrumb links based on the current page's URL.

<?php
// Sample code for breadcrumb loop with PHP tags
$breadcrumbs = array(
    'Home' => '/',
    'Category' => '/category',
    'Current Page' => ''
);

echo '<ul>';
foreach ($breadcrumbs as $label => $url) {
    if ($url) {
        echo '<li><a href="' . $url . '">' . $label . '</a></li>';
    } else {
        echo '<li>' . $label . '</li>';
    }
}
echo '</ul>';
?>