Substract from a string

Posted on 2006-11-17
Last Modified: 2008-02-01
I using $_SERVER['HTTP_REFERER'] to get the referals to my site.

And I get them as

I would like to store them as

But I need help to how substract this.
Question by:brightwood
LVL 13

Accepted Solution

rhickmott earned 500 total points
ID: 17966998

$url      =         parse_url($_SERVER['HTTP_REFERER']);
$url      =         $url['scheme'] . "://" . $url[host];
LVL 15

Expert Comment

ID: 17967008
try using the parse url function
LVL 29

Expert Comment

ID: 17967075
If it's a whole list or URL's you have to parse, you can use this:


$s = '';

preg_match_all('/.*?\/\/[^\/]+/', $s, $matches);



Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now