private function generateReferenceNumber($prefix = null, $length = 8) { $az = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZMULTIPAY'; $azr = rand(0, 51); $azs = substr($az, $azr, 10); $stamp = hash('sha256', time()); $mt = hash('sha256', mt_rand(5, 20)); $alpha = hash('sha256', $azs); $hash = str_shuffle($stamp . $mt . $alpha); $code = strtoupper(substr($hash, $azr, $length)); if (!is_null($prefix) && !empty(trim($prefix))) { $code = $prefix . $code; } return $code; }