3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($foo) { for ($i = 0; $i < $foo; $i++) { yield 'bar' . $i; } } var_dump((array)test(0)); var_dump((array)test(3));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MAFXJ
function name:  (null)
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'test'
          2        SEND_VAL                                                 0
          3        DO_FCALL                                      0  $0      
          4        CAST                                          7  ~1      $0
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                                 
   10     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'test'
          9        SEND_VAL                                                 3
         10        DO_FCALL                                      0  $3      
         11        CAST                                          7  ~4      $3
         12        SEND_VAL                                                 ~4
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

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

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.92 ms | 1399 KiB | 17 Q