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); var_dump(current($values)); var_dump(current(getValues()));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3KDXt
function name:  (null)
number of ops:  34
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                                                 
   17    19        INIT_FCALL                                               'var_dump'
         20        INIT_FCALL                                               'current'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $11     
         23        SEND_VAR                                                 $11
         24        DO_ICALL                                                 
   18    25        INIT_FCALL                                               'var_dump'
         26        INIT_FCALL                                               'current'
         27        INIT_FCALL                                               'getvalues'
         28        DO_FCALL                                      0  $13     
         29        SEND_VAR                                                 $13
         30        DO_ICALL                                         $14     
         31        SEND_VAR                                                 $14
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Function getvalues:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/3KDXt
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:
156.9 ms | 1399 KiB | 19 Q