3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Iterators\Classes; class FizzBuzz implements \Iterator { protected $pointer = 0; protected $numbers = []; public function __construct($numbers=[]) { $this->numbers = $numbers; return; } public function current() { $returnValue = ''; $returnValue .= ($this->numbers[$this->pointer]%3===0?'Fizz':''); $returnValue .= ($this->numbers[$this->pointer]%5===0?'Buzz':''); $returnValue = (empty($returnValue)?$this->numbers[$this->pointer]:$returnValue); return $returnValue; } public function key() { return $this->pointer; } public function next() { $this->pointer++; return; } public function rewind() { $this->pointer=0; return; } public function valid() { return isset($this->numbers[$this->pointer]); } }; $fizz = new FizzBuzz(2, 12); $fizz->current();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u7aYD
function name:  (null)
number of ops:  9
compiled vars:  !0 = $fizz
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                            'iterators%5Cclasses%5Cfizzbuzz'
   42     1        NEW                                              $1      'Iterators%5CClasses%5CFizzBuzz'
          2        SEND_VAL_EX                                              2
          3        SEND_VAL_EX                                              12
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   44     6        INIT_METHOD_CALL                                         !0, 'current'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Class Iterators\Classes\FizzBuzz:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u7aYD
function name:  __construct
number of ops:  5
compiled vars:  !0 = $numbers
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV_INIT                                        !0      <array>
   10     1        ASSIGN_OBJ                                               'numbers'
          2        OP_DATA                                                  !0
   11     3      > RETURN                                                   null
   12     4*     > RETURN                                                   null

End of function __construct

Function current:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 28
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 28
Branch analysis from position: 23
Branch analysis from position: 28
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
Branch analysis from position: 19
filename:       /in/u7aYD
function name:  current
number of ops:  32
compiled vars:  !0 = $returnValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, ''
   16     1        FETCH_OBJ_R                                      ~3      'pointer'
          2        FETCH_OBJ_R                                      ~2      'numbers'
          3        FETCH_DIM_R                                      ~4      ~2, ~3
          4        MOD                                              ~5      ~4, 3
          5        IS_IDENTICAL                                             ~5, 0
          6      > JMPZ                                                     ~6, ->9
          7    >   QM_ASSIGN                                        ~7      'Fizz'
          8      > JMP                                                      ->10
          9    >   QM_ASSIGN                                        ~7      ''
         10    >   ASSIGN_OP                                     8          !0, ~7
   17    11        FETCH_OBJ_R                                      ~10     'pointer'
         12        FETCH_OBJ_R                                      ~9      'numbers'
         13        FETCH_DIM_R                                      ~11     ~9, ~10
         14        MOD                                              ~12     ~11, 5
         15        IS_IDENTICAL                                             ~12, 0
         16      > JMPZ                                                     ~13, ->19
         17    >   QM_ASSIGN                                        ~14     'Buzz'
         18      > JMP                                                      ->20
         19    >   QM_ASSIGN                                        ~14     ''
         20    >   ASSIGN_OP                                     8          !0, ~14
   18    21        ISSET_ISEMPTY_CV                                         !0
         22      > JMPZ                                                     ~16, ->28
         23    >   FETCH_OBJ_R                                      ~18     'pointer'
         24        FETCH_OBJ_R                                      ~17     'numbers'
         25        FETCH_DIM_R                                      ~19     ~17, ~18
         26        QM_ASSIGN                                        ~20     ~19
         27      > JMP                                                      ->29
         28    >   QM_ASSIGN                                        ~20     !0
         29    >   ASSIGN                                                   !0, ~20
   19    30      > RETURN                                                   !0
   20    31*     > RETURN                                                   null

End of function current

Function key:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u7aYD
function name:  key
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   FETCH_OBJ_R                                      ~0      'pointer'
          1      > RETURN                                                   ~0
   24     2*     > RETURN                                                   null

End of function key

Function next:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u7aYD
function name:  next
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   PRE_INC_OBJ                                              'pointer'
   28     1      > RETURN                                                   null
   29     2*     > RETURN                                                   null

End of function next

Function rewind:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u7aYD
function name:  rewind
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   ASSIGN_OBJ                                               'pointer'
          1        OP_DATA                                                  0
   33     2      > RETURN                                                   null
   34     3*     > RETURN                                                   null

End of function rewind

Function valid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u7aYD
function name:  valid
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   FETCH_OBJ_R                                      ~1      'pointer'
          1        FETCH_OBJ_IS                                     ~0      'numbers'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~0, ~1
          3      > RETURN                                                   ~2
   38     4*     > RETURN                                                   null

End of function valid

End of class Iterators\Classes\FizzBuzz.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.07 ms | 1403 KiB | 13 Q