3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Tasodifiy kod generatsiya qiluvchi funksiya function generateFormattedCode() { // Harflar va raqamlar to'plami $characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); // Format: CUBE-XXX-XXXX-XXXX-XXX $formattedCode = 'CUBE-'; // 3 ta belgini generatsiya qilish for ($i = 0; $i < 3; $i++) { $formattedCode .= $characters[rand(0, $charactersLength - 1)]; } $formattedCode .= '-'; // 4 ta belgini generatsiya qilish for ($i = 0; $i < 4; $i++) { $formattedCode .= $characters[rand(0, $charactersLength - 1)]; } $formattedCode .= '-'; // Yana 4 ta belgini generatsiya qilish for ($i = 0; $i < 4; $i++) { $formattedCode .= $characters[rand(0, $charactersLength - 1)]; } $formattedCode .= '-'; // Oxirgi 3 ta belgini generatsiya qilish for ($i = 0; $i < 3; $i++) { $formattedCode .= $characters[rand(0, $charactersLength - 1)]; } return $formattedCode; } // Bir necha o'yin kodi generatsiya qilish function generateMultipleCodes($count) { $codes = []; // $count miqdorida kod yaratish for ($i = 0; $i < $count; $i++) { $codes[] = generateFormattedCode(); } return $codes; } // 10 ta kod generatsiya qilish $gameCodes = generateMultipleCodes(10); // Natijani ko'rsatish foreach ($gameCodes as $code) { echo $code . PHP_EOL; } ?>

preferences:
28.01 ms | 404 KiB | 5 Q