zeroise()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
zeroise( int $number, int $threshold ): string
Описание
Если задать порог ‘4’, а число равно ‘10’, вы получите ‘0010’. Если задать порог ‘4’, а число равно ‘5000’, вы получите ‘5000’.
Использует sprintf для добавления количества нулей на основе параметра $threshold и величины числа. Если число достаточно большое, нули не добавляются.
Оригинал (английский)
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.
Параметры
$number
int
обязательный
$threshold
int
обязательный
Возвращаемое значение
string
Исходный код
wp-includes/formatting.php:2791
function zeroise( $number, $threshold ) {
return sprintf( '%0' . $threshold . 's', $number );
}
История изменений
| Версия | Описание |
|---|---|
| 0.71 | Introduced. |

