Jump to content

how to manipulate strings


marklarah

Recommended Posts

Okay, so lets say i want to convert a sting of a link (eg; http://www.time.com/time/arts/article/0,8599,1725102,00.html?cnn=yes ) to just "time.com"

 

A the mo', i use

$to = "http://www.time.com/time/arts/article/0,8599,1725102,00.html?cnn=yes";

$tom = strstr($to,"www");
echo substr($tom, 0, strpos($tom, "/"))

Now, it reruns "www.time.com"

But that may just return "http:" if the url was http://example.example.com or whatever. So how to i get rid of http:// ?

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/99685-how-to-manipulate-strings/
Share on other sites

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.