PHP matching string
We can match string in PHP using strrpos function here is the sample code
<?php
function Match($keyword,$subject){
if(strrpos($subject,$keyword)===false){
return false;
}else{
return true;
}
}
$keyword = 'insicdesigns.com';
$subject = 'I love insicdesigns.com';
if(Match($keyword,$subject)){
echo 'Match!';
}else{
echo 'Not found';
}
?>
It will display…
function Match($keyword,$subject){
if(strrpos($subject,$keyword)===false){
return false;
}else{
return true;
}
}
$keyword = 'insicdesigns.com';
$subject = 'I love insicdesigns.com';
if(Match($keyword,$subject)){
echo '
echo ‘Match!’;
echo ‘
‘;
}else{
echo ‘
echo ‘Not found’;
echo ‘
‘;
}
?>


11. Dec, 2007












Again this code is very usefull. I have used this code in VECO Website.
function Match($keyword,$subject) {
return strrpos($subject,$keyword)===false;
}
Better this way