There is a certain scehema to UK V.A.T. registration numbers, just like there is for credit cards. Times them by this, add them, take away 97 etc etc... This one works it out for you....
Admittedly - if you have PHP5 - str_split would be easier than lines 8-11, and take up less space - but it will work nevertheless..
[edit]
New attachment below
[/edit]