Jump to content

[SOLVED] Removing http:// or www or both


ilikemath2002

Recommended Posts

$string = preg_replace("~(http://|www\.)~","", $string);

might be faster to use two str_replaces though:

 

$remove = array('http://','www.');
foreach($remove as $r) {
   $string = str_replace($r,'',$string);
}

 

You can benchmark it yourself if you really want to know.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.