3v4l.org

run code in 300+ PHP versions simultaneously
<?php class FooCls {} function foo(): iterable { yield new FooCls => 1; yield new FooCls => 2; yield new FooCls => 3; yield new FooCls => 4; } $iterator = foo(); assert($iterator instanceof Iterator); var_dump($iterator->key());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/usudo
function name:  (null)
number of ops:  15
compiled vars:  !0 = $iterator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'foo'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   14     3        ASSERT_CHECK                                             
          4        INIT_FCALL                                               'assert'
          5        INSTANCEOF                                       ~3      !0, 'Iterator'
          6        SEND_VAL                                                 ~3
          7        SEND_VAL                                                 'assert%28%24iterator+instanceof+Iterator%29'
          8        DO_ICALL                                                 
   16     9        INIT_FCALL                                               'var_dump'
         10        INIT_METHOD_CALL                                         !0, 'key'
         11        DO_FCALL                                      0  $5      
         12        SEND_VAR                                                 $5
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/usudo
function name:  foo
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   GENERATOR_CREATE                                         
    7     1        NEW                                              $0      'FooCls'
          2        DO_FCALL                                      0          
          3        YIELD                                                    1, $0
    8     4        NEW                                              $3      'FooCls'
          5        DO_FCALL                                      0          
          6        YIELD                                                    2, $3
    9     7        NEW                                              $6      'FooCls'
          8        DO_FCALL                                      0          
          9        YIELD                                                    3, $6
   10    10        NEW                                              $9      'FooCls'
         11        DO_FCALL                                      0          
         12        YIELD                                                    4, $9
   11    13      > GENERATOR_RETURN                                         

End of function foo

Class FooCls: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174 ms | 1403 KiB | 18 Q