this is my solution about orderid Continues numbering like -
#FD000001
#FD000002
....
#FD000099
if ($lastOrder) {
$lastOrderId = $lastOrder->unique_order_id;
$numbers = preg_replace('/[^1-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);
}