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. Quote Link to comment 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); ?> Quote Link to comment 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']; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.