3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Fizz { const KEYWORD = 'Fizz'; public static function match($index) { return !($index % 3); } } class Buzz { const KEYWORD = 'Buzz'; public static function match($index) { return !($index % 5); } } class FizzBuzzTest { public function printRange($from, $to) { for ($i = $from; $i <= $to; $i++) { $this->printFor($i); } } private function printFor($index) { if (Fizz::match($index)) { echo Fizz::KEYWORD; } if (Buzz::match($index)) { echo Buzz::KEYWORD; return; } echo $index; } } $test = new FizzBuzzTest; $test->printRange();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UIlF2
function name:  (null)
number of ops:  6
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   NEW                                              $1      'FizzBuzzTest'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   48     3        INIT_METHOD_CALL                                         !0, 'printRange'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class Fizz:
Function match:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UIlF2
function name:  match
number of ops:  5
compiled vars:  !0 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        MOD                                              ~1      !0, 3
          2        BOOL_NOT                                         ~2      ~1
          3      > RETURN                                                   ~2
   10     4*     > RETURN                                                   null

End of function match

End of class Fizz.

Class Buzz:
Function match:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UIlF2
function name:  match
number of ops:  5
compiled vars:  !0 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   19     1        MOD                                              ~1      !0, 5
          2        BOOL_NOT                                         ~2      ~1
          3      > RETURN                                                   ~2
   20     4*     > RETURN                                                   null

End of function match

End of class Buzz.

Class FizzBuzzTest:
Function printrange:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 4
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 4
Branch analysis from position: 10
Branch analysis from position: 4
filename:       /in/UIlF2
function name:  printRange
number of ops:  11
compiled vars:  !0 = $from, !1 = $to, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   27     2        ASSIGN                                                   !2, !0
          3      > JMP                                                      ->8
   28     4    >   INIT_METHOD_CALL                                         'printFor'
          5        SEND_VAR_EX                                              !2
          6        DO_FCALL                                      0          
   27     7        PRE_INC                                                  !2
          8    >   IS_SMALLER_OR_EQUAL                                      !2, !1
          9      > JMPNZ                                                    ~6, ->4
   30    10    > > RETURN                                                   null

End of function printrange

Function printfor:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/UIlF2
function name:  printFor
number of ops:  14
compiled vars:  !0 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
   34     1        INIT_STATIC_METHOD_CALL                                  'Fizz', 'match'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $1      
          4      > JMPZ                                                     $1, ->6
   35     5    >   ECHO                                                     'Fizz'
   38     6    >   INIT_STATIC_METHOD_CALL                                  'Buzz', 'match'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0  $2      
          9      > JMPZ                                                     $2, ->12
   39    10    >   ECHO                                                     'Buzz'
   40    11      > RETURN                                                   null
   43    12    >   ECHO                                                     !0
   44    13      > RETURN                                                   null

End of function printfor

End of class FizzBuzzTest.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.9 ms | 1399 KiB | 13 Q