php string contains

Posted by Paidboom - 8 months ago

php string contains : The PHP provides strpos() function to check if a string contains a specific substring or not. The strpos() function returns the position of the first occurrence of a substring in a string.

How to Check If a String Contains a Specific Word in PHP?

<?php
$word = "pakainfo";
$mystring = "The Good website pakainfojumps free the download dsource code g";

// Test if string contains the word 
if(strpos($mystring, $word) !== false){
    echo "Word Found!";
} else{
    echo "Word Not Found!";
}
?>