Home >类库下载 >PHP类库 >Generate random numbers and fill in zeros if necessary

Generate random numbers and fill in zeros if necessary

高洛峰
高洛峰Original
2016-10-21 10:29:401165browse

Generate random numbers, fill in zeros if missing

<?php
function rand_number ($min, $max) {
    return sprintf("%0".strlen($max)."d", mt_rand($min,$max));
}
?>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP method to obtain IPNext article:PHP method to obtain IP

Related articles

See more