3v4l.org

run code in 500+ PHP versions simultaneously
<?php // EXAMPLE USAGE for ($i = 0; $i < 100; $i++) { $array = generate(); echo $array[0]; echo ":"; echo $array[1]; echo "\n"; } // FUNCTION function generate() { $digilist = "2590673481AJKLXBCDMNPQRTUVWEFGHY"; //now we generate a new random ID number using the substrings of the digitList string above $id = NULL; $id .= substr($digilist, rand(1, 9), 1); //random number $id .= substr($digilist, rand(10, 31), 1); //then a letter $id .= substr($digilist, rand(10, 31), 1); //another letter $id .= substr($digilist, rand(1, 9), 1); //a number $id .= substr($digilist, rand(1, 9), 1); //and finally another number - simple :D //ok so now we need to generate an MD5 hash of our ID $hash = md5($id); //cycle through the hash 16 (length of key) times (in steps of 2 because each hex bytes is 2 digits long) $i = 0; $key = NULL; for ($i; $i < 32; $i+=2) { //here we convert the next hex value to an integer and perform a bitwise AND operation against '31' //31 is the highest substring value in our digit list. $nextdigit = hexdec(substr($hash, $i, 2)) & 31; //if 'i' is divisable by 8 (every 4 cycles) then we want to add "-" if ((($i % 8) == 0) && ($i > 0)) { $key .= "-".substr($digilist, $nextdigit, 1); } else { $key .= substr($digilist, $nextdigit, 1); } } $array = array($id, $key); //return return $array; }

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 2
Branch analysis from position: 14
Branch analysis from position: 2
filename:       /in/loFSL
function name:  (null)
number of ops:  15
compiled vars:  !0 = $i, !1 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                       !0, 0
          1      > JMP                                                          ->12
    5     2    >   INIT_FCALL_BY_NAME                                           'generate'
          3        DO_FCALL                                          0  $3      
          4        ASSIGN                                                       !1, $3
    6     5        FETCH_DIM_R                                          ~5      !1, 0
          6        ECHO                                                         ~5
    7     7        ECHO                                                         '%3A'
    8     8        FETCH_DIM_R                                          ~6      !1, 1
          9        ECHO                                                         ~6
    9    10        ECHO                                                         '%0A'
    4    11        PRE_INC                                                      !0
         12    >   IS_SMALLER                                                   !0, 100
         13      > JMPNZ                                                        ~8, ->2
   52    14    > > RETURN                                                       1

Function generate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
2 jumps found. (Code = 44) Position 1 = 68, Position 2 = 44
Branch analysis from position: 68
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
2 jumps found. (Code = 46) Position 1 = 54, Position 2 = 56
Branch analysis from position: 54
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 62
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
2 jumps found. (Code = 44) Position 1 = 68, Position 2 = 44
Branch analysis from position: 68
Branch analysis from position: 44
Branch analysis from position: 62
2 jumps found. (Code = 44) Position 1 = 68, Position 2 = 44
Branch analysis from position: 68
Branch analysis from position: 44
Branch analysis from position: 56
filename:       /in/loFSL
function name:  generate
number of ops:  73
compiled vars:  !0 = $digilist, !1 = $id, !2 = $hash, !3 = $i, !4 = $key, !5 = $nextdigit, !6 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                       !0, '2590673481AJKLXBCDMNPQRTUVWEFGHY'
   19     1        ASSIGN                                                       !1, null
   20     2        INIT_FCALL                                                   'rand'
          3        SEND_VAL                                                     1
          4        SEND_VAL                                                     9
          5        DO_ICALL                                             $9      
          6        FRAMELESS_ICALL_3                substr              ~10     !0, $9
          7        OP_DATA                                                      1
          8        ASSIGN_OP                                         8          !1, ~10
   21     9        INIT_FCALL                                                   'rand'
         10        SEND_VAL                                                     10
         11        SEND_VAL                                                     31
         12        DO_ICALL                                             $12     
         13        FRAMELESS_ICALL_3                substr              ~13     !0, $12
         14        OP_DATA                                                      1
         15        ASSIGN_OP                                         8          !1, ~13
   22    16        INIT_FCALL                                                   'rand'
         17        SEND_VAL                                                     10
         18        SEND_VAL                                                     31
         19        DO_ICALL                                             $15     
         20        FRAMELESS_ICALL_3                substr              ~16     !0, $15
         21        OP_DATA                                                      1
         22        ASSIGN_OP                                         8          !1, ~16
   23    23        INIT_FCALL                                                   'rand'
         24        SEND_VAL                                                     1
         25        SEND_VAL                                                     9
         26        DO_ICALL                                             $18     
         27        FRAMELESS_ICALL_3                substr              ~19     !0, $18
         28        OP_DATA                                                      1
         29        ASSIGN_OP                                         8          !1, ~19
   24    30        INIT_FCALL                                                   'rand'
         31        SEND_VAL                                                     1
         32        SEND_VAL                                                     9
         33        DO_ICALL                                             $21     
         34        FRAMELESS_ICALL_3                substr              ~22     !0, $21
         35        OP_DATA                                                      1
         36        ASSIGN_OP                                         8          !1, ~22
   27    37        INIT_FCALL                                                   'md5'
         38        SEND_VAR                                                     !1
         39        DO_ICALL                                             $24     
         40        ASSIGN                                                       !2, $24
   30    41        ASSIGN                                                       !3, 0
   31    42        ASSIGN                                                       !4, null
   32    43      > JMP                                                          ->66
   36    44    >   INIT_FCALL                                                   'hexdec'
         45        FRAMELESS_ICALL_3                substr              ~28     !2, !3
         46        OP_DATA                                                      2
         47        SEND_VAL                                                     ~28
         48        DO_ICALL                                             $29     
         49        BW_AND                                               ~30     $29, 31
         50        ASSIGN                                                       !5, ~30
   39    51        MOD                                                  ~32     !3, 8
         52        IS_EQUAL                                             ~33     ~32, 0
         53      > JMPZ_EX                                              ~33     ~33, ->56
         54    >   IS_SMALLER                                           ~34     0, !3
         55        BOOL                                                 ~33     ~34
         56    > > JMPZ                                                         ~33, ->62
   41    57    >   FRAMELESS_ICALL_3                substr              ~35     !0, !5
         58        OP_DATA                                                      1
         59        CONCAT                                               ~36     '-', ~35
         60        ASSIGN_OP                                         8          !4, ~36
   39    61      > JMP                                                          ->65
   45    62    >   FRAMELESS_ICALL_3                substr              ~38     !0, !5
         63        OP_DATA                                                      1
         64        ASSIGN_OP                                         8          !4, ~38
   32    65    >   ASSIGN_OP                                         1          !3, 2
         66    >   IS_SMALLER                                                   !3, 32
         67      > JMPNZ                                                        ~41, ->44
   49    68    >   INIT_ARRAY                                           ~42     !1
         69        ADD_ARRAY_ELEMENT                                    ~42     !4
         70        ASSIGN                                                       !6, ~42
   51    71      > RETURN                                                       !6
   52    72*     > RETURN                                                       null

End of function generate

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
179.01 ms | 2329 KiB | 16 Q