3v4l.org

run code in 300+ PHP versions simultaneously
<?php // The magic three sequence is the sum of the previous three values minus 1. // // 0,1,1,1,2,3,5, // // assume $n >= 0 function magicThree($n) { $n--; // To an index; $s = array(0,1,1,1); if ($n > 3) { for ($i = 0; $i < $n; $i++) { // } } else { $result = $s[$n]; } print $result; } magicThree(2); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mlEBi
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   INIT_FCALL                                               'magicthree'
          1        SEND_VAL                                                 2
          2        DO_FCALL                                      0          
   33     3      > RETURN                                                   1

Function magicthree:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 7
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
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 = 10, Position 2 = 7
Branch analysis from position: 10
Branch analysis from position: 7
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mlEBi
function name:  magicThree
number of ops:  15
compiled vars:  !0 = $n, !1 = $s, !2 = $i, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        PRE_DEC                                                  !0
   13     2        ASSIGN                                                   !1, <array>
   15     3        IS_SMALLER                                               3, !0
          4      > JMPZ                                                     ~6, ->11
   17     5    >   ASSIGN                                                   !2, 0
          6      > JMP                                                      ->8
          7    >   PRE_INC                                                  !2
          8    >   IS_SMALLER                                               !2, !0
          9      > JMPNZ                                                    ~9, ->7
         10    > > JMP                                                      ->13
   24    11    >   FETCH_DIM_R                                      ~10     !1, !0
         12        ASSIGN                                                   !3, ~10
   27    13    >   ECHO                                                     !3
   29    14      > RETURN                                                   null

End of function magicthree

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.96 ms | 1398 KiB | 14 Q