3v4l.org

run code in 300+ PHP versions simultaneously
<?php const START = 1; const END = 100; /** * バックトレースの深さからインデックス相当の値を取得 * @return int */ function getI() { // debug_backtrace: バックトレースを配列で生成 // @see https://www.php.net/manual/ja/function.debug-backtrace.php // count: 配列の長さを取得 // @see https://www.php.net/manual/ja/function.count.php return count(debug_backtrace()) - 2 + START; } /** * 再帰で Fizz, Buzz を echo */ function echoFizzBuzz() { if (getI() % 15 === 0) { echo getI().': FizzBuzz'; } elseif (getI() % 3 === 0) { echo getI().': Fizz'; } elseif (getI() % 5 === 0) { echo getI().': Buzz'; } else { echo getI().': '.getI(); } echo "\n"; // 再帰で一次変数抜きにループを実現する // 再帰でバックトレースを深くしてインデックスを進める if (getI() < END) { echoFizzBuzz(); } } echoFizzBuzz();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V9WIE
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CONST                                            'START', 1
    4     1        DECLARE_CONST                                            'END', 100
   41     2        INIT_FCALL                                               'echofizzbuzz'
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Function geti:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V9WIE
function name:  getI
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'debug_backtrace'
          1        DO_ICALL                                         $0      
          2        COUNT                                            ~1      $0
          3        SUB                                              ~2      ~1, 2
          4        FETCH_CONSTANT                                   ~3      'START'
          5        ADD                                              ~4      ~2, ~3
          6      > RETURN                                                   ~4
   17     7*     > RETURN                                                   null

End of function geti

Function echofizzbuzz:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 45
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 20
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 30
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 45
Branch analysis from position: 43
Branch analysis from position: 45
filename:       /in/V9WIE
function name:  echoFizzBuzz
number of ops:  46
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'geti'
          1        DO_FCALL                                      0  $0      
          2        MOD                                              ~1      $0, 15
          3        IS_IDENTICAL                                             ~1, 0
          4      > JMPZ                                                     ~2, ->10
   25     5    >   INIT_FCALL                                               'geti'
          6        DO_FCALL                                      0  $3      
          7        CONCAT                                           ~4      $3, '%3A+FizzBuzz'
          8        ECHO                                                     ~4
   24     9      > JMP                                                      ->37
   26    10    >   INIT_FCALL                                               'geti'
         11        DO_FCALL                                      0  $5      
         12        MOD                                              ~6      $5, 3
         13        IS_IDENTICAL                                             ~6, 0
         14      > JMPZ                                                     ~7, ->20
   27    15    >   INIT_FCALL                                               'geti'
         16        DO_FCALL                                      0  $8      
         17        CONCAT                                           ~9      $8, '%3A+Fizz'
         18        ECHO                                                     ~9
   26    19      > JMP                                                      ->37
   28    20    >   INIT_FCALL                                               'geti'
         21        DO_FCALL                                      0  $10     
         22        MOD                                              ~11     $10, 5
         23        IS_IDENTICAL                                             ~11, 0
         24      > JMPZ                                                     ~12, ->30
   29    25    >   INIT_FCALL                                               'geti'
         26        DO_FCALL                                      0  $13     
         27        CONCAT                                           ~14     $13, '%3A+Buzz'
         28        ECHO                                                     ~14
   28    29      > JMP                                                      ->37
   31    30    >   INIT_FCALL                                               'geti'
         31        DO_FCALL                                      0  $15     
         32        CONCAT                                           ~16     $15, '%3A+'
         33        INIT_FCALL                                               'geti'
         34        DO_FCALL                                      0  $17     
         35        CONCAT                                           ~18     ~16, $17
         36        ECHO                                                     ~18
   33    37    >   ECHO                                                     '%0A'
   36    38        INIT_FCALL                                               'geti'
         39        DO_FCALL                                      0  $19     
         40        FETCH_CONSTANT                                   ~20     'END'
         41        IS_SMALLER                                               $19, ~20
         42      > JMPZ                                                     ~21, ->45
   37    43    >   INIT_FCALL_BY_NAME                                       'echoFizzBuzz'
         44        DO_FCALL                                      0          
   39    45    > > RETURN                                                   null

End of function echofizzbuzz

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.73 ms | 1450 KiB | 24 Q