3v4l.org

run code in 300+ PHP versions simultaneously
<?php function random($length = 10, $charlist = '0-9a-z') { $charlist = str_shuffle(preg_replace_callback('#.-.#', function($m) { return implode('', range($m[0][0], $m[0][2])); }, $charlist)); $chLen = strlen($charlist); static $rand3; if (!$rand3) { $rand3 = md5(serialize($_SERVER), TRUE); } $s = ''; for ($i = 0; $i < $length; $i++) { if ($i % 5 === 0) { list($rand, $rand2) = explode(' ', microtime()); $rand += lcg_value(); } $rand *= $chLen; $s .= $charlist[($rand + $rand2 + ord($rand3[$i % strlen($rand3)])) % $chLen]; $rand -= (int) $rand; } return $s; } echo random(20, "0-68-9");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qrMVQ
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_FCALL                                               'random'
          1        SEND_VAL                                                 20
          2        SEND_VAL                                                 '0-68-9'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > RETURN                                                   1

Function random:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 26
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
2 jumps found. (Code = 44) Position 1 = 63, Position 2 = 29
Branch analysis from position: 63
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 46
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 63, Position 2 = 29
Branch analysis from position: 63
Branch analysis from position: 29
Branch analysis from position: 46
Branch analysis from position: 26
filename:       /in/qrMVQ
function name:  random
number of ops:  65
compiled vars:  !0 = $length, !1 = $charlist, !2 = $chLen, !3 = $rand3, !4 = $s, !5 = $i, !6 = $rand, !7 = $rand2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                        !0      10
          1        RECV_INIT                                        !1      '0-9a-z'
    4     2        INIT_FCALL                                               'str_shuffle'
          3        INIT_FCALL                                               'preg_replace_callback'
          4        SEND_VAL                                                 '%23.-.%23'
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FqrMVQ%3A4%240'
    6     6        SEND_VAL                                                 ~8
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $9      
          9        SEND_VAR                                                 $9
         10        DO_ICALL                                         $10     
    4    11        ASSIGN                                                   !1, $10
    7    12        STRLEN                                           ~12     !1
         13        ASSIGN                                                   !2, ~12
    9    14        BIND_STATIC                                              !3
   10    15        BOOL_NOT                                         ~14     !3
         16      > JMPZ                                                     ~14, ->26
   11    17    >   INIT_FCALL                                               'md5'
         18        INIT_FCALL                                               'serialize'
         19        FETCH_R                      global              ~15     '_SERVER'
         20        SEND_VAL                                                 ~15
         21        DO_ICALL                                         $16     
         22        SEND_VAR                                                 $16
         23        SEND_VAL                                                 <true>
         24        DO_ICALL                                         $17     
         25        ASSIGN                                                   !3, $17
   14    26    >   ASSIGN                                                   !4, ''
   15    27        ASSIGN                                                   !5, 0
         28      > JMP                                                      ->61
   16    29    >   MOD                                              ~21     !5, 5
         30        IS_IDENTICAL                                             ~21, 0
         31      > JMPZ                                                     ~22, ->46
   17    32    >   INIT_FCALL                                               'explode'
         33        SEND_VAL                                                 '+'
         34        INIT_FCALL                                               'microtime'
         35        DO_ICALL                                         $23     
         36        SEND_VAR                                                 $23
         37        DO_ICALL                                         $24     
         38        FETCH_LIST_R                                     $25     $24, 0
         39        ASSIGN                                                   !6, $25
         40        FETCH_LIST_R                                     $27     $24, 1
         41        ASSIGN                                                   !7, $27
         42        FREE                                                     $24
   18    43        INIT_FCALL                                               'lcg_value'
         44        DO_ICALL                                         $29     
         45        ASSIGN_OP                                     1          !6, $29
   20    46    >   ASSIGN_OP                                     3          !6, !2
   21    47        ADD                                              ~32     !6, !7
         48        INIT_FCALL                                               'ord'
         49        STRLEN                                           ~33     !3
         50        MOD                                              ~34     !5, ~33
         51        FETCH_DIM_R                                      ~35     !3, ~34
         52        SEND_VAL                                                 ~35
         53        DO_ICALL                                         $36     
         54        ADD                                              ~37     ~32, $36
         55        MOD                                              ~38     ~37, !2
         56        FETCH_DIM_R                                      ~39     !1, ~38
         57        ASSIGN_OP                                     8          !4, ~39
   22    58        CAST                                          4  ~41     !6
         59        ASSIGN_OP                                     2          !6, ~41
   15    60        PRE_INC                                                  !5
         61    >   IS_SMALLER                                               !5, !0
         62      > JMPNZ                                                    ~44, ->29
   24    63    > > RETURN                                                   !4
   25    64*     > RETURN                                                   null

End of function random

Function %00%7Bclosure%7D%2Fin%2FqrMVQ%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qrMVQ
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'implode'
          2        SEND_VAL                                                 ''
          3        INIT_FCALL                                               'range'
          4        FETCH_DIM_R                                      ~1      !0, 0
          5        FETCH_DIM_R                                      ~2      ~1, 0
          6        SEND_VAL                                                 ~2
          7        FETCH_DIM_R                                      ~3      !0, 0
          8        FETCH_DIM_R                                      ~4      ~3, 2
          9        SEND_VAL                                                 ~4
         10        DO_ICALL                                         $5      
         11        SEND_VAR                                                 $5
         12        DO_ICALL                                         $6      
         13      > RETURN                                                   $6
    6    14*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FqrMVQ%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.49 ms | 1406 KiB | 34 Q