This is just a quick post to show the use of the magic methods __call and __callStatic. It’s following on in my Magic Method series. The concept is very similar to __set/__get, basically PHP attempts to call a method on a class, if it doesn’t exist the __call method is invoked (if it does exist). __callStatic is exactly the same but with static method calls.
I was recently working on a project which needed to match a user with a county based on their (UK) postcode. In the end searched over Wikipedia and made extensive use of Google to come up with a small table which matches the postcode prefix with the postal town, county, and region. You can find a tab-separated file with this data here:
Joining mailing list will entitle you
to receive occasional emails informing you of news and
updates to the site and any special offers that may be
of interest to you.