PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
public function __construct($required = array(), $inputType = 'post')
{
if (!function_exists('filter_list')) {
throw new Exception('The Pos_Validator class requires the Filter
Functions in >= PHP 5.2 or PECL.');
}
if (!is_null($required) && !is_array($required)) {
throw new Exception('The names of required fields must be an array,
even if only one field is required.');
}
$this->_required = $required;
$this->setInputType($inputType);
}
what are the below two lines of code really doing ??
if (!function_exists('filter_list')) {
throw new Exception('The Pos_Validator class requires the Filter
Functions in >= PHP 5.2 or PECL.');
}
if (!is_null($required) && !is_array($required)) {
throw new Exception('The names of required fields must be an array,
even if only one field is required.');
}
1. If the function "filter_list" does not exist then throw the exception. That would happen if the filter functions in PHP 5.2+ or in PECL are not installed.
2. If $required is not null and it is not an array then throw the exception.
Or you could, you know, read the error messages and use the online documentation.