3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getValues() { yield "a"; yield "b"; yield "c"; } $values = getValues(); var_dump(get_class($values)); var_dump($values instanceof Generator); var_dump($values instanceof Traversable); var_dump($values instanceof Iterator);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q8lhY
function name:  (null)
number of ops:  20
compiled vars:  !0 = $values
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'getvalues'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   11     3        INIT_FCALL                                               'var_dump'
          4        GET_CLASS                                        ~3      !0
          5        SEND_VAL                                                 ~3
          6        DO_ICALL                                                 
   13     7        INIT_FCALL                                               'var_dump'
          8        INSTANCEOF                                       ~5      !0, 'Generator'
          9        SEND_VAL                                                 ~5
         10        DO_ICALL                                                 
   14    11        INIT_FCALL                                               'var_dump'
         12        INSTANCEOF                                       ~7      !0, 'Traversable'
         13        SEND_VAL                                                 ~7
         14        DO_ICALL                                                 
   15    15        INIT_FCALL                                               'var_dump'
         16        INSTANCEOF                                       ~9      !0, 'Iterator'
         17        SEND_VAL                                                 ~9
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

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

End of function getvalues

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.95 ms | 1398 KiB | 16 Q