Page 1 of 1

string contains string?

Posted: Thu Jul 10, 2003 3:10 am
by xyrial
I'll to explain my question: I have an string (url) and want to know wich searchengine it comes from.

the string is: "http://www.google.com/search?sourceid=n ... devnetwork"

and want php to let me know if string "google", "altavista" or something is in that string. How can i do that?

Do i have to use 'parse_str'? Or what? Switch/cases?

Please help me!

Posted: Thu Jul 10, 2003 3:26 am
by qartis
I use strstr, or stristr for a case-insensitive version.

Code: Select all

$string1 = "my favourite search engine is GOOGLE, ovbiously!";
$string2 = "oogle";
if (stristr($string1,$string2)){
//yep, it found it.
}

Posted: Thu Jul 10, 2003 3:58 am
by xyrial
Thanx!! work's great ;)