ok Posted August 16, 2008 Share Posted August 16, 2008 I have this string below. http://GreenCareers.com now i want to split it i want to remove this --> http:// and just retain this --> GreenCareers.com show me please. thanks in advance. Link to comment https://forums.phpfreaks.com/topic/119945-splitting-the-string/ Share on other sites More sharing options...
Bendude14 Posted August 16, 2008 Share Posted August 16, 2008 str_replace, the first option is the string you are looking for the second is what you want to replace it with. In this case nothing and the last option is the string you want to search. hope this helps <?php $string = "http://GreenCareers.com"; echo str_replace('http://', '', $string); ?> Link to comment https://forums.phpfreaks.com/topic/119945-splitting-the-string/#findComment-617906 Share on other sites More sharing options...
Barand Posted August 16, 2008 Share Posted August 16, 2008 $str = 'http://GreenCareers.com' list (,$com) = explode('//', $str); echo $com; or $parts = parse_url($str); $com = $parts['host']; Link to comment https://forums.phpfreaks.com/topic/119945-splitting-the-string/#findComment-617907 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.