3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo {} class Foos implements IteratorAggregate { private function __construct(private readonly Closure $foos) {} public static function fromVariadic(Foo ...$foos): self { return new self(fn() => yield from $foos); } public static function fromGenerator(callable $generator): self { return new self($generator); } public function getIterator(): \Traversable { return ($this->foos)(); } } //$foos = Foos::fromVariadic(new Foo, new Foo); $foos = Foos::fromGenerator(function() { yield new Foo; yield new Foo; }); foreach ($foos as $foo) { var_dump($foo); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/iO13a
function name:  (null)
number of ops:  14
compiled vars:  !0 = $foos, !1 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_CLASS                                            'foos'
   19     1        INIT_STATIC_METHOD_CALL                                  'Foos', 'fromGenerator'
          2        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   22     3        SEND_VAL_EX                                              ~2
   19     4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !0, $3
   23     6      > FE_RESET_R                                       $5      !0, ->12
          7    > > FE_FETCH_R                                               $5, !1, ->12
   24     8    >   INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
   23    11      > JMP                                                      ->7
         12    >   FE_FREE                                                  $5
   25    13      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/iO13a
function name:  {closure}
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   GENERATOR_CREATE                                         
   20     1        NEW                                              $0      'Foo'
          2        DO_FCALL                                      0          
          3        YIELD                                                    $0
   21     4        NEW                                              $3      'Foo'
          5        DO_FCALL                                      0          
          6        YIELD                                                    $3
   22     7      > GENERATOR_RETURN                                         

End of Dynamic Function 0

Class Foo: [no user functions]
Class Foos:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iO13a
function name:  __construct
number of ops:  4
compiled vars:  !0 = $foos
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'foos'
          2        OP_DATA                                                  !0
          3      > RETURN                                                   null

End of function __construct

Function fromvariadic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iO13a
function name:  fromVariadic
number of ops:  10
compiled vars:  !0 = $foos
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_VARIADIC                                    !0      
    8     1        NEW                          self                $1      
          2        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
          3        BIND_LEXICAL                                             ~2, !0
          4        SEND_VAL_EX                                              ~2
          5        DO_FCALL                                      0          
          6        VERIFY_RETURN_TYPE                                       $1
          7      > RETURN                                                   $1
    9     8*       VERIFY_RETURN_TYPE                                       
          9*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/iO13a
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $foos
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   GENERATOR_CREATE                                         
          1        BIND_STATIC                                              !0
          2        YIELD_FROM                                       ~1      !0
          3      > GENERATOR_RETURN                                         
          4*     > GENERATOR_RETURN                                         

End of Dynamic Function 0

End of function fromvariadic

Function fromgenerator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iO13a
function name:  fromGenerator
number of ops:  8
compiled vars:  !0 = $generator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        NEW                          self                $1      
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        VERIFY_RETURN_TYPE                                       $1
          5      > RETURN                                                   $1
   12     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function fromgenerator

Function getiterator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iO13a
function name:  getIterator
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~0      'foos'
          1        INIT_DYNAMIC_CALL                                        ~0
          2        DO_FCALL                                      0  $1      
          3        VERIFY_RETURN_TYPE                                       $1
          4      > RETURN                                                   $1
   15     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function getiterator

End of class Foos.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.34 ms | 1450 KiB | 14 Q