3v4l.org

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

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

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.78 ms | 1398 KiB | 14 Q