3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class Foo implements IteratorAggregate { public function getIterator() { return function() { yield from ['A', 'B', 'C']; yield from ['D', 'E', 'F']; }; } } print_r(iterator_to_array(new Foo()));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fK1Wh
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                            'foo'
   15     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'iterator_to_array'
          3        NEW                                              $0      'Foo'
          4        DO_FCALL                                      0          
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FfK1Wh%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/fK1Wh
function name:  {closure}
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   GENERATOR_CREATE                                         
    9     1        YIELD_FROM                                       ~0      <array>
          2        FREE                                                     ~0
   10     3        YIELD_FROM                                       ~1      <array>
          4        FREE                                                     ~1
   11     5      > GENERATOR_RETURN                                         

End of function %00%7Bclosure%7D%2Fin%2FfK1Wh%3A8%240

Class Foo:
Function getiterator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fK1Wh
function name:  getIterator
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfK1Wh%3A8%240'
   11     1      > RETURN                                                   ~0
   12     2*     > RETURN                                                   null

End of function getiterator

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
187.91 ms | 1395 KiB | 17 Q