Last Updated: June 11, 2021
·
1.688K
· 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;
}

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.

Security insights from Cside