3v4l.org

run code in 300+ PHP versions simultaneously
<?php class FizzBuzzEngine { public function run($limit = 100) { for ($i = 1; $i <= $limit; $i++) { $output = ''; if ($i % 3 == 0) { $output .= "Fizz"; } if ($i % 5 == 0) { $output .= "Buzz"; } if($i * 10 > 100){ $output = ""; $output = "Foo"; } if($i % 7 == 0 ){ $output = ""; $output.= "Bar"; } if (empty($output)) { $output = 'None'; } echo sprintf('%d: %s', $i, $output . PHP_EOL); } } } $engine = new FizzBuzzEngine(); $engine->run();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PInfb
function name:  (null)
number of ops:  6
compiled vars:  !0 = $engine
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   NEW                                              $1      'FizzBuzzEngine'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   33     3        INIT_METHOD_CALL                                         !0, 'run'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class FizzBuzzEngine:
Function run:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 3
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 3
Branch analysis from position: 35
Branch analysis from position: 3
Branch analysis from position: 25
Branch analysis from position: 22
Branch analysis from position: 17
Branch analysis from position: 12
Branch analysis from position: 8
filename:       /in/PInfb
function name:  run
number of ops:  36
compiled vars:  !0 = $limit, !1 = $i, !2 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV_INIT                                        !0      100
    7     1        ASSIGN                                                   !1, 1
          2      > JMP                                                      ->33
    8     3    >   ASSIGN                                                   !2, ''
    9     4        MOD                                              ~5      !1, 3
          5        IS_EQUAL                                                 ~5, 0
          6      > JMPZ                                                     ~6, ->8
   10     7    >   ASSIGN_OP                                     8          !2, 'Fizz'
   12     8    >   MOD                                              ~8      !1, 5
          9        IS_EQUAL                                                 ~8, 0
         10      > JMPZ                                                     ~9, ->12
   13    11    >   ASSIGN_OP                                     8          !2, 'Buzz'
   16    12    >   MUL                                              ~11     !1, 10
         13        IS_SMALLER                                               100, ~11
         14      > JMPZ                                                     ~12, ->17
   17    15    >   ASSIGN                                                   !2, ''
   18    16        ASSIGN                                                   !2, 'Foo'
   20    17    >   MOD                                              ~15     !1, 7
         18        IS_EQUAL                                                 ~15, 0
         19      > JMPZ                                                     ~16, ->22
   21    20    >   ASSIGN                                                   !2, ''
   22    21        ASSIGN_OP                                     8          !2, 'Bar'
   24    22    >   ISSET_ISEMPTY_CV                                         !2
         23      > JMPZ                                                     ~19, ->25
   25    24    >   ASSIGN                                                   !2, 'None'
   27    25    >   INIT_FCALL                                               'sprintf'
         26        SEND_VAL                                                 '%25d%3A+%25s'
         27        SEND_VAR                                                 !1
         28        CONCAT                                           ~21     !2, '%0A'
         29        SEND_VAL                                                 ~21
         30        DO_ICALL                                         $22     
         31        ECHO                                                     $22
    7    32        PRE_INC                                                  !1
         33    >   IS_SMALLER_OR_EQUAL                                      !1, !0
         34      > JMPNZ                                                    ~24, ->3
   29    35    > > RETURN                                                   null

End of function run

End of class FizzBuzzEngine.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.61 ms | 1002 KiB | 14 Q