| Welcome to WebmasterWorld Guest from 184.108.40.206 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Become a Pro Member|
|remove characters up to specific character|
I need to remove all characters up to specific character in a string. I've searched in vain for a answer, so I hope you can help me.
It's to build a index/sitemap automatically
I have code that looks through specific directory's and outputs a list of contents:-
$filename = name_of_file.htm
$menuitem = name_of_file [.htm and '_' stripped]
My problem is the site is in two languages so ideally I'd like:-
<li><a href="http://'path/to'.$filename.'">'.ucfirst($menuitem).'<br />'.ucfirst($second_menuitem).'</a></li>
$filename = 'English_name~Spanish_name.htm'
$menuitem = 'English_name'
$second_menuitem = 'Spanish_name'
I've worked out how to strip everything after a the "~", but can't fathom how to strip everything before the "~"
Any help would be much appreciated.
|Kings on steeds|
list($one,$two) = split('~',$filename);
$menu_one = $one;
$menu_two = str_replace('.html','',$two);
Not sure if its what your after, but the above will pass 'English_name' to $menu_one and 'Spanish_name' to $menu_two
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved