Saturday, February 16, 2013

Search or Find Keyword Using Php Script

Search any keyword or specific string using php programming script.use php function strstr().

Means :
strstr() means Find the first occurrence of a string .
find word from particular string using php
use strstr() maeans ‘Find the first occurrence of a string’ ,



Example :

$string = ‘website php tutplus themeforest mcxstar’;
$find = ‘php’;

if(strstr($string, $find) ===false)
{
echo ‘<BR>NO – Did not find <br/><u style="color:red;">’.$find.’</u> in <b>’.$string.’</b>’;
}
else
{
echo ‘<BR>YES – Found<br/> <u style="color:green;">’.$find.’</u> in <b>’.$string.’</b>’;
}


Output :
YES-Found php 

 

2 comments:

  1. I was about to implement a search feature in my website and your code absolutely matching my requirements. I have bookmarked your blog and will be visiting regularly.

    ReplyDelete
  2. i worked this one in my pc. the outcome was good. thanks for sharing this one
    php development

    ReplyDelete

Thanks....