Searches value for a match to the regular expression given in expression. This function is identical to the preg_match() fucntion except this will return false it the $value is an array.
Quote
preg_check ( string $expression, mixed $value )
<?php
$value = "123abc"
if (preg_check("/^[0-9A-Za-z]+$/", $value)) {
echo "The string only contains alphanumeric chars.";
} else {
echo "The string contains non alphanumeric chars.";
}
?>
Quote
The string only contains alphanumeric chars.
<?php
$value = array("123abc");
if (preg_check("/^[0-9a-z]{32}$/", $value)) {
echo "The string only contains alphanumeric chars.";
} else {
echo "The string contains non alphanumeric chars.";
}
?>
Quote
The string contains non alphanumeric chars.