PHP 7 Script to Check if a String Contains a Specific Word or Not Using strpos() Method Full Project For Beginners

  • Post Author:
  • Post Category:PHP
  • Post Comments:0 Comments


Welcome folks today in this blog post we will be checking if a string contains a specific world or not using strpos() method using php 7. All the full source code of the application is shown below.




Get Started




In order to get started you need to make an index.php file and copy paste the following code






$str='Codespeedy Codes faster and also in efficient manner';//source string
$s='Codes';//finding string
$i = $m = $c =$flag=0;
  while ( !empty($str[$c]))
    if ( $str[$m] == $s[$i] ) 
      if ( empty($s[$i]))     //Find occurance
        echo $s.' is present in '.($c+1).' location<br>';
    else     //... mismatch
      $m = $c;
    echo $s.' is not present';

Leave a Reply