PrintingTShirts user this
order id like - OD-062021-4733
$unique_order_id = 'OD' . '-' . date('mY') . '-' .rand(10,10000);
order numbers are repeating issue solved use this
#FD000001
#FD000002
#FD000010
....
#FD000099
if ($lastOrder) {
$lastOrderId = $lastOrder->unique_order_id;
$numbers = preg_replace('/[^0-9]/', '', $lastOrderId);
$newId = 'FD'.str_pad($numbers + 1, 6, '0', STR_PAD_LEFT);
} else {
//first order
$newId = 'FD'.str_pad(1, 6, '0', STR_PAD_LEFT);
}