- var_dump: documentation ( source)
- uniqid: documentation ( source)
- microtime: documentation ( source)
- mt_rand: documentation ( source)
- mt_srand: documentation ( source)
- date: documentation ( source)
- str_pad: documentation ( source)
<?php
function build_order_no()
{
mt_srand((double) microtime() * 1000000);
return date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);
}
$i = 10;
while($i) {
$no = build_order_no();
$uniqid = uniqid();
var_dump("$no\n$uniqid\n"); // file_put_contents('test.log', "$no\n$uniqid\n", FILE_APPEND);
--$i;
}
echo PHP_EOL;