3v4l.org

run code in 300+ PHP versions simultaneously
<?php function one_to_ten() { for ($i = 1; $i <= 10; $i++) { yield $i; } } function test() { $generator = one_to_ten(); $sum = 0; foreach ($generator as $value) { $sum += $value; } assert($sum == 55); } test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g7HbI
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'test'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

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

End of function one_to_ten

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/g7HbI
function name:  test
number of ops:  16
compiled vars:  !0 = $generator, !1 = $sum, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'one_to_ten'
          1        DO_FCALL                                      0  $3      
          2        ASSIGN                                                   !0, $3
   11     3        ASSIGN                                                   !1, 0
   12     4      > FE_RESET_R                                       $6      !0, ->8
          5    > > FE_FETCH_R                                               $6, !2, ->8
   13     6    >   ASSIGN_OP                                     1          !1, !2
   12     7      > JMP                                                      ->5
          8    >   FE_FREE                                                  $6
   15     9        ASSERT_CHECK                                             
         10        INIT_FCALL                                               'assert'
         11        IS_EQUAL                                         ~8      !1, 55
         12        SEND_VAL                                                 ~8
         13        SEND_VAL                                                 'assert%28%24sum+%3D%3D+55%29'
         14        DO_ICALL                                                 
   16    15      > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
202.23 ms | 1399 KiB | 17 Q