3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { $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)]; } $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(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 2
Branch analysis from position: 7
Branch analysis from position: 2
filename:       /in/8jaLo
function name:  (null)
number of ops:  8
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->5
   19     2    >   INIT_FCALL                                               'test'
          3        DO_FCALL                                      0          
   18     4        PRE_INC                                                  !0
          5    >   IS_SMALLER                                               !0, 100000
          6      > JMPNZ                                                    ~4, ->2
   20     7    > > RETURN                                                   1

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

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.76 ms | 1407 KiB | 18 Q