- mt_rand: documentation ( source)
- range: documentation ( source)
- sprintf: documentation ( source)
<?php
if (is_int(0x7FFFFFFF + 1)) {
function foo() {
return sprintf("%16x", mt_rand(-0x7FFFFFFFFFFFFFFF - 1, 0x7FFFFFFFFFFFFFFF));
}
}
else {
function foo() {
return sprintf(
"%08x%08x",
mt_rand(-0x7FFFFFFF - 1, 0x7FFFFFFF),
mt_rand(-0x7FFFFFFF - 1, 0x7FFFFFFF)
);
}
}
foreach (range(1, 5) as $i) {
echo foo(), "\n";
}