Definition:
function zeroise($number, $threshold) {}
Add leading zeros when necessary.
If you set the threshold to ‘4’ and the number is ’10’, then you will get back ‘0010’. If you set the threshold to ‘4’ and the number is ‘5000’, then you will get back ‘5000’.
Parameters
- mixed $number: Number to append zeros to if not greater than threshold.
- int $threshold: Digit places number needs to be to not have zeros added.
Return values
returns:Adds leading zeros to number if needed.
Source code
function zeroise($number, $threshold) { return sprintf('%0'.$threshold.'s', $number); }
4289
No comments yet... Be the first to leave a reply!