Learning PHP and MySQL
Example 11-13 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.");
}
?>
Example 11-13 outputs the following:
Passwords cannot contain the word “password”.
Posted by on 08/18 at 05:56 PM