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]

    your coding a little bunched up... for more readabiliy i suggest useing more spaces. plus, take advantage of things like +=, -=, etc. i found about three places you could've used those.

    by the way, i've added that with a different name to my web function library. never know when it's going to some in handy 😃

      your gonna have to show me the third example of the += etc i can only find two.

      Anyway how is that bunched up. You wouldnt like my code if you think that is bunched up that and i dont comment much

        i just mean there are no spaces around your operators. i like your brace style.. that's how i do it myself 🙂

        and there were only two i realize now, but i cut out the $tot variable because its unneeded.

          i just mean there are no spaces around your operators.

          It doesnt really matter if there is or isnt spaces it works no matter what. However i do relise this is my opinion and thats yours. Im not going to start a Coding Standards Debate

            lol true. but you must admit the $tot variable was superfluous... or don't i don't care :p

              boring yes
              useful yes

              this is the kinda thing that in a b2b ordering process makes the whole thing so much more professional - stuff like this, postcode verification of addresses on a site and so on just makes me think 'these people have got thier s*** together'

              i like thanks, even if it thinks 'andy' is a valid vat number and it doesn't take spaces into account either but they're just tiny tweaks. otherwise thanks for knocking something up that i'll use now it's to hand but would never have sat and written.

              tis the most handy thing i've found on this forum in recent weeks, now if only someone could code function(findgoodwoman); or should i stop staring at a screen and get out more........ don't answer that! 😉

                5 days later

                Many thanks for the critique - I just wondered if it was possible....

                As for the shortening of the code itself.. and removing of the $tot - I do agree, however I musta missed it when shortening the code after testing... (echo $tot to verify was easier than echo $arr[$i]*$z; But there ya go....)

                As for += and -= something I am not familiar with - any clues ?

                As for the verification of numerical values only and the spaces thing, an is_nan and a nice regexp or str_replace would sort that one out.....

                See the amended version....

                [edit]
                And amended again += is good 😃

                  Write a Reply...