O'Reilly logo

Zend PHP 5 Certification Study Guide by Ben Ramsey, Davey Shafik

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix B: Filter Extension Filters and Flags

The filter extension defines 3 types of filters, validation, sanitization, and callback. Additionally, there are a number of flags that change the way these filters are applied.

Validation Filters

Constant Name Options Flags Description

FILTER_VALIDATE_BOOLEAN

boolean

default

FILTER_NULL_ON_FAILURE

Validates value as being boolean-like. - Returns true for all truthy values: 1, true, on and yes - Returns false otherwise.

If the option FILTER_NULL_ON_FAILURE is used, false is returned only for falsey values: 0, false, off, no, and ''. A non-boolean value returns null

FILTER_VALIDATE_EMAIL

validate_email

default

Validates value as an e-mail.

FILTER_VALIDATE_FLOAT

float

default

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required