3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { $x = (yield 1); echo $x . 'x'; $y = (yield 2); echo $y; } $val = test(); //$val->current(); $val->send('test'); $val->current();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PQ4X1
function name:  (null)
number of ops:  9
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, 'send'
          4        SEND_VAL_EX                                              'test'
          5        DO_FCALL                                      0          
   14     6        INIT_METHOD_CALL                                         !0, 'current'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/PQ4X1
function name:  test
number of ops:  9
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        CONCAT                                           ~4      !0, 'x'
          4        ECHO                                                     ~4
    7     5        YIELD                                            $5      2
          6        ASSIGN                                                   !1, $5
    8     7        ECHO                                                     !1
    9     8      > GENERATOR_RETURN                                         

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.39 ms | 1397 KiB | 14 Q