I have a row of data which contains numbers and splits by ‘-‘, sth like this: 2012-421-020-120407
Now I want to generate a parity digit (0 or 1) at the end of this string in my php code. But
I have no idea how to do it.
Thanks in advance
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you have your numbers, use
%to determine if the number is divisible by 2. If it is, it’s even. If it’s not, it’s odd. Gather your parity from that result.If you would like the parity of the sum of numbers, you can try the following: