Jochem Maas wrote:
> Brian P. Giroux wrote:
>> I am just learning PHP and as a practical exercise I've been working on
>> a set of functions to process and manipulate what I call "normalized
>> number" (ISBNs, EANs, UPCs, etc...)
>>
>> My ultimate goal is to create a normnum class and child classes for the
>> different types of numbers.
>>
>> Because of my line of work, I am mostly interested in ISBN-10s,
>> ISBN-13s, EANs and UPCs, but it can also be expanded to credit card
>> numbers, Canadian Social Insurance Numbers, and many more.
>>
>> So far I have functions to validate ISBN-10s and EANs although I've run
>> into a bit of a wall with the digit_sum function as explained in the B:
>> section of that functions header comments.
> 
> if you want to turn the direction around reverse the string before
> you start the loop:
>       http://php.net/manual/en/function.strrev.php

I never thought of turning the string around.

> personally I would turn the string into an array of chars (which you can then 
> also
> reverse as need be) and then do a foreach loop on it ('array index'+1 can be 
> used
> to determine position) ... personal preference. anyway take a look at these 
> functions:

Is there a reason for converting to an array. It seems to me that the
conversion would add more overhead.

>       http://php.net/manual/en/function.str-split.php
>       http://php.net/array_reverse
>       http://php.net/foreach
>> If anyone can help me out with that or provide any other advice about
>> the rest of it, I'd be grateful.
> 
> keep commenting all your code to that extent! you do us proud :-)

Thanks, I don't have much choice. I can only work on this every few
days, sometimes every few weeks. If I don't comment I find that I forget
what I was doing :(

Thanks for your input.

>> The file can be found at http://www.senecal.ca/normnums.php.txt
>>
>> Thanks.

-- 
Brian P. Giroux

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to