I work to count the number of digits in PHP. I just want to count the number of digits for the database. The first issue has zero funds, it does not take as a number to count.
, eg:
12 ==number of count value is 2 122 ==number of count value is 3
I can achieve this through function.here is my function.
function count_digit($number) { return strlen((string) $number); } $number = 12312; echo count_digit($number);
But I need to add zero for this number $num = 0012312; (zero-fill).
012 == number of count value is 3 0133 == number of count value is 4
Let me know how to solve it.
user2388680
source share