Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

WordCount Validator

The WordCount validator checks for the number of words within provided files. It supports the following option keys:

  • min: Sets the minimum number of words to be found.

  • max: Sets the maximum number of words to be found.

If you initiate this validator with a string or integer, the value will be used as max. Or you can also use the methods setMin() and setMax() to set both options afterwards and getMin() and getMax() to retrieve the actual set values.

Example 427. Using the WordCount Validator

= new Zend_File_Transfer();

// Limit the amount of words within files to maximum 2000

// Limit the amount of words within files to maximum 5000 and minimum 1000 words
$upload->addValidator('WordCount'false, array('min' => 1000'max' => 5000));

Zend Framework