From af3da2e42abb1a4db4e8a0e9656ffbc180c360e0 Mon Sep 17 00:00:00 2001 From: "Kar l5.G" Date: Wed, 2 Apr 2025 19:16:22 +0530 Subject: [PATCH] 1 --- siliconid.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 siliconid.php diff --git a/siliconid.php b/siliconid.php new file mode 100644 index 0000000..ee941b7 --- /dev/null +++ b/siliconid.php @@ -0,0 +1,21 @@ + 0) { + $result = $chars[$num % 62] . $result; + $num = floor($num / 62); + } + return $result; +} + +function generateID() { + $epochStart = strtotime('2020-01-01') * 1000; + $now = round(microtime(true) * 1000) - $epochStart; + $random = rand(0, 999); // 3-digit random number + $id = ($now * 1000) + $random; // Combine timestamp + randomness + return substr(str_pad(toBase62($id), 8, "0", STR_PAD_LEFT), 0, 8); // Ensure 8 chars +} + +echo generateID(); // Example output: "4D7hF2L3" +?>