3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { echo 1; echo (yield 'a'); echo 2; yield 'b'; echo 3; yield 'c'; echo 4; yield 'd'; } $val = test(); $val->current(); $val->send('ok'); //echo "|" . $val->current() . "|"; //$val->send('yes'); //echo "|" . $val->current() . "|"; //$val->next(); //$val->current(); //$val->send('no'); //echo "|" . $val->current() . "|";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5gMHo
function name:  (null)
number of ops:  9
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'test'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   17     3        INIT_METHOD_CALL                                         !0, 'current'
          4        DO_FCALL                                      0          
   18     5        INIT_METHOD_CALL                                         !0, 'send'
          6        SEND_VAL_EX                                              'ok'
          7        DO_FCALL                                      0          
   25     8      > RETURN                                                   1

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

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.26 ms | 1397 KiB | 14 Q