Back-End Development PHP basics

Breadcrumb in php

Breadcrumb in php to dynamically create breadcrumbs from the URL. We use php globals $_SERVER[”] to get the path in Uri. This path is exploded to create breadcrumbs.

Breadcrumb in php -snippet

With this code we have integrated, Bootstrap breadcrumbs. Ordered list has the class “breadcrumb” which stylizes the display of the breadcrumb list.

Understanding the code:

explode() : breaks a string to array. The separator cannot be blank space..
$_SERVER['REQUEST_URI'] : will hold the full request path including the query string. In other words, it will return the path completely.
ucfirst() : this function is used to convert first letter of the string to uppercase.
str_replace() : this function is used to replace characters with some other characters in the string. In this function it replaces every “.php” and “-“ with blank space.

Example for sample url : http://www.scanfcode.com/sample/pg3.php the output is:
Breadcrumb in php

Summary
Breadcrumb in php
Article Name
Breadcrumb in php
Description
Breadcrumb in php to dynamically create breadcrumbs from the URL. We use php globals $_SERVER[''] to get the path in Uri. This path is exploded to create breadcrumbs
Author
Publisher Name
Scanfcode
Publisher Logo