3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { $x = (yield 1); echo $x; $y = (yield 2); echo $y; } $val = test(); echo $val->current(); echo $val->next(); echo $val->current(); echo $val->next(); /*echo $val->send('test'); echo '<br>'; $val->send('test');*/
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B7n2I
function name:  (null)
number of ops:  16
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'test'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   13     3        INIT_METHOD_CALL                                         !0, 'current'
          4        DO_FCALL                                      0  $3      
          5        ECHO                                                     $3
   14     6        INIT_METHOD_CALL                                         !0, 'next'
          7        DO_FCALL                                      0  $4      
          8        ECHO                                                     $4
   15     9        INIT_METHOD_CALL                                         !0, 'current'
         10        DO_FCALL                                      0  $5      
         11        ECHO                                                     $5
   16    12        INIT_METHOD_CALL                                         !0, 'next'
         13        DO_FCALL                                      0  $6      
         14        ECHO                                                     $6
   20    15      > RETURN                                                   1

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

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.56 ms | 1398 KiB | 14 Q