Detecting whether a string is contained in another string : stristr « String « PHP






Detecting whether a string is contained in another string

 
<?php
$password="secretpassword1";

if (strstr($password,"password")){
    echo('Passwords cannot contain the word "password".');
}
else {
    echo ("Password accepted.");
}
?>
  
  








Related examples in the same category

1.Using Substring Alternatives