Home'; // Initialize last bool. $last = FALSE; // Process each crumb, skipping the first which is Home. for ($i=1; $i < $crumb_count; ++$i) { if ($i == ($crumb_count-1)) { // End of the line! $last = TRUE; } // Build this crumb's URL. $crumb_url .= $url[$i]; // Add trailing slash if not last crumb $crumb_url .= (!$last) ? '/' : ''; // Replace all dashes and underscores with spaces for URL title. $title = str_replace(array('-','_'), array(' ',' '), $url[$i]); // uppercase each word and convert all symbols to HTML entities for security. $title = htmlentities(ucwords($title), ENT_QUOTES); $breadcrumbs .= ' > '; // If not last item, which should be current page, make a link to that crumb, else just show title. $breadcrumbs .= (!$last) ? ''.$title.'' : $title; } echo $breadcrumbs; ?>