homeHome contactContact portfolioPortfolio musicMusic videoVideo historyHistory calendarCalendar rssRSS
karlpox | with GOD all things are possible

Search a string in a string PHP

This is how you search a string from a string. For example you have this sentence.

“I went to the mall yesterday.”

So lets store that in an variable.

$source = "I went to the mall yesterday.";

Now lets look for the word mall. To do that analyze the code below.

if ( strtr($source,"mall") )
{
echo 'String Found!';
}
else
{
echo 'String not Found!';
}

Hope this code can be useful!

Write a Comment