3v4l.org

run code in 500+ PHP versions simultaneously
<?php function makeCodes($numCodes, $codeLength) { $digits = '01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $codes = []; $nextCode = 0; for ($i = 0; $i<$numCodes; $i++) { $code = ''; for ($j = 0; $j<$codeLength-3;$j++) { $code .= $digits[random_int(0,strlen($digits)-1)]; } $codes[] = sprintf('%s%03X', $code, $nextCode); $nextCode++; } return $codes; } print_r(makeCodes(10, 24));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cboZ0
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                                   'print_r'
          1        INIT_FCALL                                                   'makecodes'
          2        SEND_VAL                                                     10
          3        SEND_VAL                                                     24
          4        DO_FCALL                                          0  $0      
          5        SEND_VAR                                                     $0
          6        DO_ICALL                                                     
          7      > RETURN                                                       1

Function makecodes:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 7
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 10
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 7
Branch analysis from position: 33
Branch analysis from position: 7
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 10
Branch analysis from position: 22
Branch analysis from position: 10
filename:       /in/cboZ0
function name:  makeCodes
number of ops:  35
compiled vars:  !0 = $numCodes, !1 = $codeLength, !2 = $digits, !3 = $codes, !4 = $nextCode, !5 = $i, !6 = $code, !7 = $j
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    5     2        ASSIGN                                                       !2, '01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    6     3        ASSIGN                                                       !3, <array>
    7     4        ASSIGN                                                       !4, 0
    8     5        ASSIGN                                                       !5, 0
          6      > JMP                                                          ->31
    9     7    >   ASSIGN                                                       !6, ''
   10     8        ASSIGN                                                       !7, 0
          9      > JMP                                                          ->19
   11    10    >   INIT_FCALL                                                   'random_int'
         11        SEND_VAL                                                     0
         12        STRLEN                                               ~14     !2
         13        SUB                                                  ~15     ~14, 1
         14        SEND_VAL                                                     ~15
         15        DO_ICALL                                             $16     
         16        FETCH_DIM_R                                          ~17     !2, $16
         17        ASSIGN_OP                                         8          !6, ~17
   10    18        PRE_INC                                                      !7
         19    >   SUB                                                  ~20     !1, 3
         20        IS_SMALLER                                                   !7, ~20
         21      > JMPNZ                                                        ~21, ->10
   13    22    >   INIT_FCALL                                                   'sprintf'
         23        SEND_VAL                                                     '%25s%2503X'
         24        SEND_VAR                                                     !6
         25        SEND_VAR                                                     !4
         26        DO_ICALL                                             $23     
         27        ASSIGN_DIM                                                   !3
         28        OP_DATA                                                      $23
   14    29        PRE_INC                                                      !4
    8    30        PRE_INC                                                      !5
         31    >   IS_SMALLER                                                   !5, !0
         32      > JMPNZ                                                        ~26, ->7
   16    33    > > RETURN                                                       !3
   17    34*     > RETURN                                                       null

End of function makecodes

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.17 ms | 1381 KiB | 17 Q