3v4l.org

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

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

End of function count_digits

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.6 ms | 1389 KiB | 16 Q