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

Generate random numbers and fill in zeros if necessary

高洛峰
Release: 2016-10-21 10:29:40
Original
1161 people have browsed it

Generate random numbers, fill in zeros if missing

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


Related labels:
php
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template