3v4l.org

run code in 300+ PHP versions simultaneously
<?php $logfile = fopen('/tmp/out', 'w+'); function test($logfile) { $chars = '0123456789abcdefghijklmnopqrstuvwxyz'; $base = mt_rand(2, 36); $len = mt_rand(10, 100); $str = ''; for ($i = 0; $i < $len; ++$i) { $str .= $chars[mt_rand(0, $base - 1)]; } fprintf($logfile, "base %s value %s\n", $base, $str); $gmp = gmp_init($str, $base); $val = gmp_strval($str, $base); $val = str_pad($val, strlen($str), '0', STR_PAD_LEFT); if ($val !== $str) { throw new Exception('Not same - base '.$base."\n-".$str."\n+".$val); } } for($i = 0; $i < 100000; ++$i) { test($logfile); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 7
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 7
Branch analysis from position: 13
Branch analysis from position: 7
filename:       /in/Oo2JU
function name:  (null)
number of ops:  14
compiled vars:  !0 = $logfile, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'fopen'
          1        SEND_VAL                                                 '%2Ftmp%2Fout'
          2        SEND_VAL                                                 'w%2B'
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !0, $2
   21     5        ASSIGN                                                   !1, 0
          6      > JMP                                                      ->11
   22     7    >   INIT_FCALL                                               'test'
          8        SEND_VAR                                                 !0
          9        DO_FCALL                                      0          
   21    10        PRE_INC                                                  !1
         11    >   IS_SMALLER                                               !1, 100000
         12      > JMPNZ                                                    ~7, ->7
   23    13    > > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 15
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 60
Branch analysis from position: 51
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 15
Branch analysis from position: 25
Branch analysis from position: 15
filename:       /in/Oo2JU
function name:  test
number of ops:  61
compiled vars:  !0 = $logfile, !1 = $chars, !2 = $base, !3 = $len, !4 = $str, !5 = $i, !6 = $gmp, !7 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, '0123456789abcdefghijklmnopqrstuvwxyz'
    6     2        INIT_FCALL                                               'mt_rand'
          3        SEND_VAL                                                 2
          4        SEND_VAL                                                 36
          5        DO_ICALL                                         $9      
          6        ASSIGN                                                   !2, $9
    7     7        INIT_FCALL                                               'mt_rand'
          8        SEND_VAL                                                 10
          9        SEND_VAL                                                 100
         10        DO_ICALL                                         $11     
         11        ASSIGN                                                   !3, $11
    8    12        ASSIGN                                                   !4, ''
    9    13        ASSIGN                                                   !5, 0
         14      > JMP                                                      ->23
   10    15    >   INIT_FCALL                                               'mt_rand'
         16        SEND_VAL                                                 0
         17        SUB                                              ~15     !2, 1
         18        SEND_VAL                                                 ~15
         19        DO_ICALL                                         $16     
         20        FETCH_DIM_R                                      ~17     !1, $16
         21        ASSIGN_OP                                     8          !4, ~17
    9    22        PRE_INC                                                  !5
         23    >   IS_SMALLER                                               !5, !3
         24      > JMPNZ                                                    ~20, ->15
   12    25    >   INIT_FCALL                                               'fprintf'
         26        SEND_VAR                                                 !0
         27        SEND_VAL                                                 'base+%25s+value+%25s%0A'
         28        SEND_VAR                                                 !2
         29        SEND_VAR                                                 !4
         30        DO_ICALL                                                 
   13    31        INIT_FCALL_BY_NAME                                       'gmp_init'
         32        SEND_VAR_EX                                              !4
         33        SEND_VAR_EX                                              !2
         34        DO_FCALL                                      0  $22     
         35        ASSIGN                                                   !6, $22
   14    36        INIT_FCALL_BY_NAME                                       'gmp_strval'
         37        SEND_VAR_EX                                              !4
         38        SEND_VAR_EX                                              !2
         39        DO_FCALL                                      0  $24     
         40        ASSIGN                                                   !7, $24
   15    41        INIT_FCALL                                               'str_pad'
         42        SEND_VAR                                                 !7
         43        STRLEN                                           ~26     !4
         44        SEND_VAL                                                 ~26
         45        SEND_VAL                                                 '0'
         46        SEND_VAL                                                 0
         47        DO_ICALL                                         $27     
         48        ASSIGN                                                   !7, $27
   16    49        IS_NOT_IDENTICAL                                         !7, !4
         50      > JMPZ                                                     ~29, ->60
   17    51    >   NEW                                              $30     'Exception'
         52        CONCAT                                           ~31     'Not+same+-+base+', !2
         53        CONCAT                                           ~32     ~31, '%0A-'
         54        CONCAT                                           ~33     ~32, !4
         55        CONCAT                                           ~34     ~33, '%0A%2B'
         56        CONCAT                                           ~35     ~34, !7
         57        SEND_VAL_EX                                              ~35
         58        DO_FCALL                                      0          
         59      > THROW                                         0          $30
   19    60    > > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.55 ms | 1407 KiB | 22 Q