Forum Moderators: coopster
$check_url = "http://example.com/index.php?action=a&mode=b&blabla";
I want to check the if the $check_url contains the $ref_url or not.
Thanks in advance to all of you.
[edited by: eelixduppy at 11:46 am (utc) on July 6, 2007]
[edit reason] example.com [/edit]
<?php
$ref_url = 'http://example.com';
$check_url = 'http://example.com/index.php?action=a&mode=b&blabl';
if (strstr($check_url, $ref_url))
{echo 'Eureka!';}
else {echo ' Not found! ';}
?>
From PHP manual:
Note: If you only want to determine if a particular needle occurs within haystack, use the faster and less memory intensive function strpos() instead.
I could have done this, but just wanted to fix what I wrote first out of my head.
I actually like Gian's solution better than mine too, btw, but I thought I should show another way to skin this cat.