News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rob Allen's Blog:
Validating UK Postcodes
November 15, 2010 @ 12:29:35

Rob Allen has shared a bit of code he's put together to help with validating UK postal codes (since the functionality in Zend_Validate doesn't cooperate), so he extended the main Zend_Validate_PostCode with his own validator.

It's easy enough to add a filter to remove the space, but I'm a little worried that when (and if) it gets fixed, will the fixed version Zend_Validate_PostCode then fail to validate postcodes without the space? In theory it should as the space is part of the spec. I'd hate my code to unexpectedly break due to a valid bug fix. I can easy work around this worry though by simply creating my own extension of Zend_Validate_PostCode.

The thirty-five line code example allows you to correctly validate the postal code with a quick call to the "isValid" method. He also links to another method from Paul Court to handle things similarly.

0 comments voice your opinion now!
postcode uk validation zendframework zendvalidate


blog comments powered by Disqus

Similar Posts

Matthew Weir O'Phinney's Blog: BostonPHP Framework Presentations

PHPImpact Blog: PHPUnit: Testing Zend Framework Controllers

Padraic Brady's Blog: Zend Framework: Surviving The Deep End - Performance Optimisation

Zend Developer Zone: How to avoid Identity Theft in Zend Framework with Zend Auth

Spindrop.us: Creating, Updating, Deleting documents in a Lucene Index with symfony


Community Events

Don't see your event here?
Let us know!


api series opinion framework application example voicesoftheelephpant php7 release configure performance library interview part2 podcast introduction laravel conference symfony2 community

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework