Filters in Zend Framework with Examples?

Answer

The Zend_Filter component provides a set of commonly needed data filters. It also provides a simple filter chaining mechanism by which multiple filters may be applied to a single datum in a user-defined order.

Example:
// Add an email element
$this->addElement(‘text’, ‘email’, array(
‘label’ => ‘Your email address:’,
‘required’ => true,
‘filters’ => array(‘StringTrim’),
‘validators’ => array(
‘EmailAddress’,
)
));
Other Filters:

Alnum – Zend_Filter_Alnum is a filter which returns only alphabetic characters and digits. All other characters are supressed.
Alpha – Zend_Filter_Alpha is a filter which returns the string $value, removing all but alphabetic characters. This filter includes an option to also allow white space characters.

All zend-framework Questions

Ask your interview questions on zend-framework

Write Your comment or Questions if you want the answers on zend-framework from zend-framework Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---