3v4l.org

run code in 300+ PHP versions simultaneously
<?php function count_digits($digit, $base) { // TODO: add type validation return $digit >= 10 ? 1 + count_digits($digit / $base) : 1; } $digit = 1554; $tries = 10000; var_dump(count_digits($digit));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VNMu8
function name:  (null)
number of ops:  9
compiled vars:  !0 = $digit, !1 = $tries
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, 1554
    9     1        ASSIGN                                                   !1, 10000
   11     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'count_digits'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function count_digits:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VNMu8
function name:  count_digits
number of ops:  14
compiled vars:  !0 = $digit, !1 = $base
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        IS_SMALLER_OR_EQUAL                                      10, !0
          3      > JMPZ                                                     ~2, ->11
          4    >   INIT_FCALL_BY_NAME                                       'count_digits'
          5        DIV                                              ~3      !0, !1
          6        SEND_VAL_EX                                              ~3
          7        DO_FCALL                                      0  $4      
          8        ADD                                              ~5      1, $4
          9        QM_ASSIGN                                        ~6      ~5
         10      > JMP                                                      ->12
         11    >   QM_ASSIGN                                        ~6      1
         12    > > RETURN                                                   ~6
    6    13*     > RETURN                                                   null

End of function count_digits

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.52 ms | 1398 KiB | 16 Q