(preg_match return 1 if there is a match in the string, 0 otherwise).
<?php
$data = 'bad';
if (strpos($data, 'bad')!==false or strpos($data, 'naughty')!== false) {
echo "Found";
} else {
echo "Not Found";
}
?>
Type: | php |
Category: | Web Tutorial |
Sub Category: | PHP String Tutorial |
Uploaded by: | Admin |