poe Posted December 3, 2007 Share Posted December 3, 2007 how would i remove the: (http | https | ftp) :// www. from a url if it is present so: http://www.chris.com = chris.com http://chris.com/home.html = chris.com/home.html etc... thanks Link to comment https://forums.phpfreaks.com/topic/79935-remove-http-or-www-from-url/ Share on other sites More sharing options...
effigy Posted December 3, 2007 Share Posted December 3, 2007 <pre> <?php $data = <<<DATA http://www.chris.com = chris.com http://chris.com/home.html = chris.com/home.html DATA; echo preg_replace('%(?:https?|ftp)://(?:www\.)?%', '', $data); ?> </pre> Link to comment https://forums.phpfreaks.com/topic/79935-remove-http-or-www-from-url/#findComment-405108 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.