Last Updated: June 11, 2021
·
1.521K
· charlie-hadden

Simple breadcrumb function

When you only want to generate a simple breadcrumb, a large library is often overkill. Instead, a simple function like this is easy to use, runs very fast, and is only a few extra lines of code.

function breadcrumb($url = null, $title = null)
{
    static $breadcrumb = array();

    if($url && $title)
        $breadcrumb[$url] = $title;

    return $breadcrumb;
}