3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { echo '1' . (yield 1) . '|'; echo '2' . (yield 2). '|'; } $val = test(); $val->rewind(); var_dump($val->current()); //$val->next(); //var_dump($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/jOeSo
function name:  (null)
number of ops:  11
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'test'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   10     3        INIT_METHOD_CALL                                         !0, 'rewind'
          4        DO_FCALL                                      0          
   11     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'current'
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                                 
   22    10      > RETURN                                                   1

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

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.71 ms | 1397 KiB | 16 Q