Number.zeroPadLeft
zeroPadLeft($numDigits) -> string
Description
Append zeros to the left of a number to reach $numDigits
in length.
The number will be automatically converted to an integer.
Returns a string.
$num = 123 $num.zeroPadLeft(5) //= '00123' $num.zeroPadLeft(1) //= '123' $num = 123.45 $num.zeroPadLeft(5) //= '00123'