PHP Simple modification/correction

Posted by Adrian M. on Stack Overflow See other posts from Stack Overflow or by Adrian M.
Published on 2010-04-08T10:48:55Z Indexed on 2010/04/08 10:53 UTC
Read the original article Hit count: 363

Filed under:
|
|
|

Hello,

I got this code from someone, it's almost perfect to create a dynamic breadcrumb, but there just a little glitch because it echoes two dividers before the breadcrumb:

$crumbs = explode("/",$_SERVER["REQUEST_URI"]);
foreach($crumbs as $crumb){
    echo ucfirst(str_replace(array(".php","_"),array(""," "),'>' . $crumb));
}

it echoes:

">>content>common>file"

what I want it to look like is

"content>common>1"

and also I will deeply appreciate if someone can tell me how can I add links for all the items in the array except the last one (file)?

Thank you so much everybody, this website really helped me a lot to learn php by examples!

© Stack Overflow or respective owner

Related posts about php

Related posts about breadcrumb