This doesn't work! For values less than 10, this routine doesn't work, as the $second_last_digit will always be the same as $last_digit due to the way PHP works. $second_last_digit = substr($number, -2, 1); If the string in only one character, it will return that character, which then breaks your logic. Reply
For values less than 10, this routine doesn't work, as the $second_last_digit will always be the same as $last_digit due to the way PHP works.
$second_last_digit = substr($number, -2, 1);
If the string in only one character, it will return that character, which then breaks your logic.