3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { yield 1; yield 2; yield 3; yield 4; } var_dump(foo() instanceof Traversable); $fooG = foo(); array_walk($fooG, function ($foo) { var_dump($foo); }); iterator_apply($fooG, function ($foo) { var_dump($foo); });
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XhXZ5
function name:  (null)
number of ops:  20
compiled vars:  !0 = $fooG
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'foo'
          2        DO_FCALL                                      0  $1      
          3        INSTANCEOF                                       ~2      $1, 'Traversable'
          4        SEND_VAL                                                 ~2
          5        DO_ICALL                                                 
   14     6        INIT_FCALL                                               'foo'
          7        DO_FCALL                                      0  $4      
          8        ASSIGN                                                   !0, $4
   16     9        INIT_FCALL                                               'array_walk'
         10        SEND_REF                                                 !0
         11        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FXhXZ5%3A16%240'
   18    12        SEND_VAL                                                 ~6
         13        DO_ICALL                                                 
   20    14        INIT_FCALL                                               'iterator_apply'
         15        SEND_VAR                                                 !0
         16        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FXhXZ5%3A20%241'
   22    17        SEND_VAL                                                 ~8
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

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

End of function foo

Function %00%7Bclosure%7D%2Fin%2FXhXZ5%3A16%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XhXZ5
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   18     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FXhXZ5%3A16%240

Function %00%7Bclosure%7D%2Fin%2FXhXZ5%3A20%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XhXZ5
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   22     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FXhXZ5%3A20%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.14 ms | 1403 KiB | 21 Q