Property for sale in Spain - Myspace Layouts - Mortgage Calculator - Loans - Gas Suppliers

PDA

View Full Version : To check whether a string is a Substring of another


subeeshkk
Jan 28th 2008, 4:36 am
Hi all ,

Pls hlp me , i am a beginner ,

I want to check whether a string is substring of another string , how do i do that.....

substr returns the substring with the given start and end , but i just need to know , whether str1 is in str2....

Thanks in advance

nico_swd
Jan 28th 2008, 4:39 am
Use strpos():



if (strpos($str2, $str1) !== false)
{
// str1 is in str2
}