Filter key.
string $key Key.:
mixed $default Default = null.:
boolean $deep Default = false.:
integer $filter FILTER_* constant.:
mixed $options Filter options.:
mixed
http://php.net/manual/en/function.filter-var.php
public function filter($key, $default = null, $deep = false, $filter = FILTER_DEFAULT, $options = array()) {
$value = $this
->get($key, $default, $deep);
// Always turn $options into an array - this allows filter_var option shortcuts.
if (!is_array($options) && $options) {
$options = array(
'flags' => $options,
);
}
// Add a convenience check for arrays.
if (is_array($value) && !isset($options['flags'])) {
$options['flags'] = FILTER_REQUIRE_ARRAY;
}
return filter_var($value, $filter, $options);
}