Codex

Function Reference/zeroise

Contents

Description

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'.

Uses sprintf to append the amount of zeros based on the $threshold parameter and the size of the number. If the number is large enough, then no zeros will be appended.

Usage

<?php zeroise$number$threshold ); ?>

Parameters

$number
(mixed) (required) Number to append zeros to if not greater than threshold.
Default: None
$threshold
(integer) (required) Digit places number needs to be to not have zeros added.
Default: None

Return Values

(string) 
Adds leading zeros to number if needed.

Examples

Notes

Change Log

Since: 0.71

Source File

zeroise() is located in wp-includes/formatting.php.

Related

See also index of Function Reference and index of Template Tags.