Validating and filtering are often related to forms, but they can be used separately. To emphasize this and also just to keep the book well structured, I reserve this separate chapter for validation and filtering. Filtering and validating can be used against any form of data, regardless of whether forms are involved. In ZF1, validation was tied closely to forms, but you could use it separately, too, by using
Zend_Filter_Input. This component has been replaced and improved by
Zend\InputFilter\InputFilter. Also, the new input filter is now the single centralized way to filter and validate at all times.
Suppose that we want to simply validate a
'lastname', without ...