Latest Bloggings

Validating email addresses more easily in PHP

Tue, Jun 14th 2011, 19:14

For years when I was validating email addresses on forms on old PHP websites, I would always use a regular expression stolen from the internet and preg_match() to validate the email string against the regular expression, which has served me well for many years - until today when I got a bug re[...]

How to turn off CakePHP Model Find Callbacks

Mon, Jun 13th 2011, 19:36

Something I had a major headache with today was the very useful callback methods in CakePHP's Model class. I was using the afterFind() method to check a record and then perform a lookup on the same table, which naturally ended up creating an infinite loop. The solution obviously was to turn off[...]