mysql - How to calculate personal number by date of birth using php -


i want make calculation of personal number date of birth.

the calculation done in manner:

ex. 8 (day) +12 (month) + 1 + 9 + 7 + 1 (year) = 38 = 3 + 8 = 11 = 1 + 1 = 2  

(the final number)

this final number must not greater nine.

so:

  • the first number comes 38 greater 9 , should make 3 + 8
  • the second number comes 11 greater 9 should make 1 + 1
  • the third number comes 2 less 9 final number.

taking these calculations should let out number 2.

how can php calculation?

i suppose, can split date array. then

$arr = array(8,12,1,9,7,1); // sum array, split sum array per digit untill more 1 digit in sum while (count($arr = str_split(array_sum($arr))) != 1)  {}  echo $arr[0]; // 2 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -