Can anyone tell me why this isn't working? It always returns false.
$str = "huuhhu
moo.com
www";
if (preg_match('/(\
|\\
|\)/', $str) === true) {
echo "True";
} else {
echo "False";
}
Can anyone tell me why this isn't working? It always returns false.
$str = "huuhhu
moo.com
www";
if (preg_match('/(\
|\\
|\)/', $str) === true) {
echo "True";
} else {
echo "False";
}
preg_match doesn't return true. It returns the number of matches. You need to do this:
$str = "huuhhu
moo.com
www";
if (preg_match('/(\
|\\
|\)/', $str)) {
echo "True";
} else {
echo "False";
}
Also, you could probably simplify your expression to this:
'/
|
?/'