- substr: documentation ( source)
- array_map: documentation ( source)
- uniqid: documentation ( source)
- implode: documentation ( source)
- date: documentation ( source)
- file_put_contents: documentation ( source)
- str_split: documentation ( source)
<?php
function build_order_no()
{
return date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
}
$i = 10;
while($i) {
$no = build_order_no();
$uniqid = uniqid();
file_put_contents('test.log', "$no\n$uniqid\n", FILE_APPEND);
--$i;
}
echo PHP_EOL;