3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calculateLevels( $total, $iteration = 0 ) { if( $total <= 1 ) { return $iteration; } else { return calculateLevels( (int) ( $total / 2 ), $iteration + 1 ); } } $x = 15; echo "$x - " .calculateLevels( $x ) . "\n"; $x = 10; echo "$x - " .calculateLevels( $x ) . "\n"; $x = 8; echo "$x - " .calculateLevels( $x ) . "\n"; $x = 7; echo "$x - " .calculateLevels( $x ) . "\n"; $x = 1; echo "$x - " .calculateLevels( $x ) . "\n"; $x = 2; echo "$x - " .calculateLevels( $x ) . "\n"; $x = 3; echo "$x - " .calculateLevels( $x ) . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YO1Pi
function name:  (null)
number of ops:  64
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, 15
          1        NOP                                                      
          2        FAST_CONCAT                                      ~2      !0, '+-+'
          3        INIT_FCALL                                               'calculatelevels'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $3      
          6        CONCAT                                           ~4      ~2, $3
          7        CONCAT                                           ~5      ~4, '%0A'
          8        ECHO                                                     ~5
   17     9        ASSIGN                                                   !0, 10
         10        NOP                                                      
         11        FAST_CONCAT                                      ~7      !0, '+-+'
         12        INIT_FCALL                                               'calculatelevels'
         13        SEND_VAR                                                 !0
         14        DO_FCALL                                      0  $8      
         15        CONCAT                                           ~9      ~7, $8
         16        CONCAT                                           ~10     ~9, '%0A'
         17        ECHO                                                     ~10
   18    18        ASSIGN                                                   !0, 8
         19        NOP                                                      
         20        FAST_CONCAT                                      ~12     !0, '+-+'
         21        INIT_FCALL                                               'calculatelevels'
         22        SEND_VAR                                                 !0
         23        DO_FCALL                                      0  $13     
         24        CONCAT                                           ~14     ~12, $13
         25        CONCAT                                           ~15     ~14, '%0A'
         26        ECHO                                                     ~15
   19    27        ASSIGN                                                   !0, 7
         28        NOP                                                      
         29        FAST_CONCAT                                      ~17     !0, '+-+'
         30        INIT_FCALL                                               'calculatelevels'
         31        SEND_VAR                                                 !0
         32        DO_FCALL                                      0  $18     
         33        CONCAT                                           ~19     ~17, $18
         34        CONCAT                                           ~20     ~19, '%0A'
         35        ECHO                                                     ~20
   20    36        ASSIGN                                                   !0, 1
         37        NOP                                                      
         38        FAST_CONCAT                                      ~22     !0, '+-+'
         39        INIT_FCALL                                               'calculatelevels'
         40        SEND_VAR                                                 !0
         41        DO_FCALL                                      0  $23     
         42        CONCAT                                           ~24     ~22, $23
         43        CONCAT                                           ~25     ~24, '%0A'
         44        ECHO                                                     ~25
   21    45        ASSIGN                                                   !0, 2
         46        NOP                                                      
         47        FAST_CONCAT                                      ~27     !0, '+-+'
         48        INIT_FCALL                                               'calculatelevels'
         49        SEND_VAR                                                 !0
         50        DO_FCALL                                      0  $28     
         51        CONCAT                                           ~29     ~27, $28
         52        CONCAT                                           ~30     ~29, '%0A'
         53        ECHO                                                     ~30
   22    54        ASSIGN                                                   !0, 3
         55        NOP                                                      
         56        FAST_CONCAT                                      ~32     !0, '+-+'
         57        INIT_FCALL                                               'calculatelevels'
         58        SEND_VAR                                                 !0
         59        DO_FCALL                                      0  $33     
         60        CONCAT                                           ~34     ~32, $33
         61        CONCAT                                           ~35     ~34, '%0A'
         62        ECHO                                                     ~35
         63      > RETURN                                                   1

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

End of function calculatelevels

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.75 ms | 950 KiB | 21 Q