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-XXXX-XXXX-XXXX-XXXX $format = 'CUBE-XXXX-XXXX-XXXX-XXXX'; $formattedCode = ''; // Format bo'yicha kod yaratish for ($i = 0; $i < strlen($format); $i++) { if ($format[$i] === 'X') { $formattedCode .= $characters[rand(0, $charactersLength - 1)]; } else { $formattedCode .= $format[$i]; } } 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(4); // Natijani ko'rsatish foreach ($gameCodes as $code) { echo $code . PHP_EOL; } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/Z1tNf
function name:  (null)
number of ops:  11
compiled vars:  !0 = $gameCodes, !1 = $code
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   INIT_FCALL                                               'generatemultiplecodes'
          1        SEND_VAL                                                 4
          2        DO_FCALL                                      0  $2      
          3        ASSIGN                                                   !0, $2
   40     4      > FE_RESET_R                                       $4      !0, ->9
          5    > > FE_FETCH_R                                               $4, !1, ->9
   41     6    >   CONCAT                                           ~5      !1, '%0A'
          7        ECHO                                                     ~5
   40     8      > JMP                                                      ->5
          9    >   FE_FREE                                                  $4
   43    10      > RETURN                                                   1

Function generateformattedcode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 7
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 7
Branch analysis from position: 24
Branch analysis from position: 7
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 7
Branch analysis from position: 24
Branch analysis from position: 7
filename:       /in/Z1tNf
function name:  generateFormattedCode
number of ops:  26
compiled vars:  !0 = $characters, !1 = $charactersLength, !2 = $format, !3 = $formattedCode, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    6     1        STRLEN                                           ~6      !0
          2        ASSIGN                                                   !1, ~6
    9     3        ASSIGN                                                   !2, 'CUBE-XXXX-XXXX-XXXX-XXXX'
   10     4        ASSIGN                                                   !3, ''
   13     5        ASSIGN                                                   !4, 0
          6      > JMP                                                      ->21
   14     7    >   FETCH_DIM_R                                      ~11     !2, !4
          8        IS_IDENTICAL                                             ~11, 'X'
          9      > JMPZ                                                     ~12, ->18
   15    10    >   INIT_FCALL                                               'rand'
         11        SEND_VAL                                                 0
         12        SUB                                              ~13     !1, 1
         13        SEND_VAL                                                 ~13
         14        DO_ICALL                                         $14     
         15        FETCH_DIM_R                                      ~15     !0, $14
         16        ASSIGN_OP                                     8          !3, ~15
   14    17      > JMP                                                      ->20
   17    18    >   FETCH_DIM_R                                      ~17     !2, !4
         19        ASSIGN_OP                                     8          !3, ~17
   13    20    >   PRE_INC                                                  !4
         21    >   STRLEN                                           ~20     !2
         22        IS_SMALLER                                               !4, ~20
         23      > JMPNZ                                                    ~21, ->7
   21    24    > > RETURN                                                   !3
   22    25*     > RETURN                                                   null

End of function generateformattedcode

Function generatemultiplecodes:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 4
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 4
Branch analysis from position: 11
Branch analysis from position: 4
filename:       /in/Z1tNf
function name:  generateMultipleCodes
number of ops:  13
compiled vars:  !0 = $count, !1 = $codes, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   26     1        ASSIGN                                                   !1, <array>
   29     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->9
   30     4    >   INIT_FCALL                                               'generateformattedcode'
          5        DO_FCALL                                      0  $6      
          6        ASSIGN_DIM                                               !1
          7        OP_DATA                                                  $6
   29     8        PRE_INC                                                  !2
          9    >   IS_SMALLER                                               !2, !0
         10      > JMPNZ                                                    ~8, ->4
   33    11    > > RETURN                                                   !1
   34    12*     > RETURN                                                   null

End of function generatemultiplecodes

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.78 ms | 1458 KiB | 16 Q