Hey I want to edit my string $url..
in this case $url is equal to 'admin/page/add'
I want to change $url to $url_bread and change the string to 'admin >> page >> add'
so to recap: I want to change
'admin/page/add'
for every '/' I want there to be ' >> '
thanks guys
Working with simple STrings
Moderator: General Moderators
http://www.php.net/str_replace
Code: Select all
<?php
$url = "admin/page/add";
$url_bread = str_replace("/", " >> ", $url);
?>- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
That works great, but not completely.. I think this is the best I am going to get, but if it is possible, could I capitalize every first letter?
for instance
Original:
With ucfirst():
What I hope is possible to do next:
THANKS!
PS: love this php community its been a big help, I will definetly help spread the word
for instance
Original:
Code: Select all
"admin >> page >> addCode: Select all
"Admin >> page >> addCode: Select all
"Admin >> Page>> AddPS: love this php community its been a big help, I will definetly help spread the word
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Wait ignore that one!! Just figured it out
Code: Select all
guav_sys_url_name();
global $url;
$url_bread = str_replace("/", " >> ", $url);
$url_bread = ucwords($url_bread);
$url_bread = ucwords(strtolower($url_bread));
echo '<small>' . $url_bread . '</small>';