3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { $n = 1; $x = yield; echo $x; echo $n; $n++; $x = yield; echo $x; echo $n; $n++; $x = yield; echo $x; echo $n; $n++; } $test = test(); $test->send('A'); $test->send('B'); $test->send('C');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jcZge
function name:  (null)
number of ops:  13
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_FCALL                                               'test'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   24     3        INIT_METHOD_CALL                                         !0, 'send'
          4        SEND_VAL_EX                                              'A'
          5        DO_FCALL                                      0          
   25     6        INIT_METHOD_CALL                                         !0, 'send'
          7        SEND_VAL_EX                                              'B'
          8        DO_FCALL                                      0          
   26     9        INIT_METHOD_CALL                                         !0, 'send'
         10        SEND_VAL_EX                                              'C'
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/jcZge
function name:  test
number of ops:  18
compiled vars:  !0 = $n, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    5     1        ASSIGN                                                   !0, 1
    7     2        YIELD                                            $3      
          3        ASSIGN                                                   !1, $3
    8     4        ECHO                                                     !1
    9     5        ECHO                                                     !0
   10     6        PRE_INC                                                  !0
   12     7        YIELD                                            $6      
          8        ASSIGN                                                   !1, $6
   13     9        ECHO                                                     !1
   14    10        ECHO                                                     !0
   15    11        PRE_INC                                                  !0
   17    12        YIELD                                            $9      
         13        ASSIGN                                                   !1, $9
   18    14        ECHO                                                     !1
   19    15        ECHO                                                     !0
   20    16        PRE_INC                                                  !0
   21    17      > GENERATOR_RETURN                                         

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.52 ms | 1390 KiB | 14 Q