I am building breadcrumbs and I would like to do it from all segments from the current url. I am getting the array that looks like this
$segments = [0 =>'users',
1 =>'index',
2 =>'all'];
I'd like to combine the array in this way :
$routes = [ 0 =>'users',
1 =>'users/index',
2 =>'users/index/all'];
I have tried using array_map
$segs = array_map(function($a){return $a."/".$a;},$segments);
but it combines the same array item twice
Any help is appreciated.