3v4l.org

run code in 300+ PHP versions simultaneously
<?php function x() { yield 1; return 5; } $a = x(); var_dump($a->current()); $a->next(); var_dump($a->current()); $a->next(); var_dump($a->current()); var_dump($a->getReturn());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4L6ac
function name:  (null)
number of ops:  28
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'x'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
    6     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'current'
          5        DO_FCALL                                      0  $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                                 
    7     8        INIT_METHOD_CALL                                         !0, 'next'
          9        DO_FCALL                                      0          
    8    10        INIT_FCALL                                               'var_dump'
         11        INIT_METHOD_CALL                                         !0, 'current'
         12        DO_FCALL                                      0  $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                                 
    9    15        INIT_METHOD_CALL                                         !0, 'next'
         16        DO_FCALL                                      0          
   10    17        INIT_FCALL                                               'var_dump'
         18        INIT_METHOD_CALL                                         !0, 'current'
         19        DO_FCALL                                      0  $9      
         20        SEND_VAR                                                 $9
         21        DO_ICALL                                                 
   11    22        INIT_FCALL                                               'var_dump'
         23        INIT_METHOD_CALL                                         !0, 'getReturn'
         24        DO_FCALL                                      0  $11     
         25        SEND_VAR                                                 $11
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

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

End of function x

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.53 ms | 1399 KiB | 16 Q