kejo Posted February 24, 2008 Share Posted February 24, 2008 hello i would like to split: www.site.com/page.php?q=SPLITHERE&cat=0&others=1 into www.site.com/page.php?q= and &cat=0&others=1 how can i do that? i tried with explode, but it didnt work. please help Link to comment https://forums.phpfreaks.com/topic/92652-how-to-split-an-url-in-2-parts-i-dont-need-parse_url/ Share on other sites More sharing options...
Barand Posted February 24, 2008 Share Posted February 24, 2008 try <?php $url = "www.site.com/page.php?q=&cat=0&others=1"; $p = strpos($url, '='); $part1 = substr($url, 0, $p+1); $part2 = substr($url, $p+1); echo "$part1<br/>$part2"; ?> Link to comment https://forums.phpfreaks.com/topic/92652-how-to-split-an-url-in-2-parts-i-dont-need-parse_url/#findComment-474829 Share on other sites More sharing options...
kejo Posted February 24, 2008 Author Share Posted February 24, 2008 thanks my friend! it works fine Link to comment https://forums.phpfreaks.com/topic/92652-how-to-split-an-url-in-2-parts-i-dont-need-parse_url/#findComment-474830 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.