Home >Backend Development >PHP Tutorial >Example of using the validator InArray of the zf framework_PHP tutorial
function check_inarray($person)
{
$array = array('Zhang San','Li Si','Wang Wu','Zhao Liu','Tian Qi');
$Validate = new Zend_Validate_InArray($array);
if ($Validate -> isValid($person))
{
echo "There is this person!";
}
else
{
echo "There is no such person!";
}
}
$person = 'Zhang San';
check_inarray($person);
?>