Jump to content

Recommended Posts

Hi,
I'm using a referral script on my page and it looks like this
[quote]
11/07/06, 12:48 www.blablabla.com
11/07/06, 12:31 www.blablabla.org
11/07/06, 12:27 www.blablabla.be
11/07/06, 12:24 www.blablabla.nl
11/07/06, 12:21 www.blablabla.be
11/07/06, 12:18 blablabla.com
11/07/06, 12:13 www.blablabla.com
11/07/06, 12:03 www.blablabla.be
11/07/06, 12:00 blablabla.be
11/07/06, 12:00 www.blablabla.be
[/quote]

is there a way to remove the www. on the referrals (that have one of course).
So in other words I need a script that deletes a certain follow up of chars (in this case www.) in a given string.

have another question about the date this time.
it's generated by this code (it's a phpbb forum)
[code]'LAST' => create_date($board_config['default_dateformat'], $row['referrer_lastvisit'], $board_config['board_timezone']))
[/code]

is it possible to drop the date and only display the time?
thanks in advance
Bundy
Link to comment
https://forums.phpfreaks.com/topic/14288-string-trim-and-date-problem/
Share on other sites

There is no universial rule to strip those www. but you can write a function.

it's simple and safe:

function stripWWW($str)
{
   $pattern = substr($str, 0,4);
   if (strcasecmp($pattern,'www.') == 0)
       return substr($str,4);
   else return $str;
}

echo stripWWW('www.google.com'); // echo google.com
echo stripWWW('google.com'); // echo google.com
echo stripWWW('www.www.net'); // echo www.net
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.