I'm trying to split a URL path into individual strings in an array. I've tried a few things and this is as close as I've gotten:

```
<?php   
$url = '/category/subcategory/item';

$output = array(); 
$chunks = explode('/', $url); 
foreach ($chunks as $i => $chunk) 
{
    $output[] = sprintf
    (
        //'<a href="#/%s">%s</a>',
        implode('/', array_slice($chunks, 0, $i + 1)),
        $chunk
    );
}

echo implode(' &gt;&gt; ', $output);

include 'footer.php';
?>

```

This returns:

> 
> /category >> /category/subcategory >> /category/subcategory/item
> 
> 
> 

but I would like to try and return

> 
> category >> subcategory >> item
> 
> 
> 

Thanks!