Hi folks,

I'm trying to compare two strings in order to determine whether or not
the site is just switching languages on the same page or whether the
link is pointing to an entirely different page.  Things were fine
until I realized I was getting false positives for subpages, where the
URLs matched.

Previous code example:

if (strpos('http://domain.com/fr/about/page/', '/about/page/') > -1){
    $same_page = true;
}

As you can see this logic is not strong enough to deal with:

if (strpos(http://domain.com/about/page/subpage/', '/about/page/') > -1){
    $same_page = true;
}

As it is not the same page.  I've looked into strrpos() and tried to
use the negative offset as the length of the needle, but unfortunately
it searches backwards from the offset and not forwards.  Any ideas?

Marc

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to