This little object is intended as a canned and generic validator for Zend Framework. It is intended for use with Form Elements, but it should work fairly broadly. The basic need it addresses is to validate that one field value matches another (e.g. password/email and and associated validation field, a captcha challenge, etc.). I looked hard for a ready made answer to this issue, but after much searching and failed experimentation with canned solutions I decided to write my OWN generic answer to the problem.
An example call to this function might look something like this:
Aaaaaand the valididator itself:
For the sake of simplicity I have renamed the objects here to use the Zend namespace as explaining the eccentricities of extending objects and registering paths in Zend goes well beyond the scope of what I wish to cover in this article. In practice, one should not plop this object into the Zend/Validate directory but should create a different path in the library and register that path with the appropriate Zend objects.
Back Reference: ref: http://www.emanaton.com/node/38