Joshua F Posted November 8, 2010 Share Posted November 8, 2010 I am having problems making it so that if I typed site.php?url=http://example.com it would auto get rid of the http://. Here's my code. $url="{$_GET['url']}"; str_replace('http://', '', $url); echo "<a href=\"http://$url\">$url</a>"; Link to comment https://forums.phpfreaks.com/topic/218054-how-would-i-get-rid-of-a-part/ Share on other sites More sharing options...
trq Posted November 8, 2010 Share Posted November 8, 2010 Your not using the data returned by str_replace. $url="{$_GET['url']}"; $url = str_replace('http://', '', $url); echo "<a href=\"http://$url\">$url</a>"; Link to comment https://forums.phpfreaks.com/topic/218054-how-would-i-get-rid-of-a-part/#findComment-1131565 Share on other sites More sharing options...
Joshua F Posted November 8, 2010 Author Share Posted November 8, 2010 Ahh, I feel dumb. Forgot about that. Thanks. Link to comment https://forums.phpfreaks.com/topic/218054-how-would-i-get-rid-of-a-part/#findComment-1131566 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.