- mt_rand: documentation ( source)
- range: documentation ( source)
- sprintf: documentation ( source)
<?php
function foo() {
return sprintf(
"%07x%07x%02x",
mt_rand(0, 0xFFFFFFF),
mt_rand(0, 0xFFFFFFF),
mt_rand(0, 0xFF)
);
}
foreach (range(1, 5) as $i) {
echo foo(), "\n";
}