3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(1,2,3); function foo($arr) { $result = array(); foreach($arr as $el) { $result[] = $el * 2; } return $result; } function foo2($arr) { $result = array(); foreach($arr as $el) { yield $el; } } echo foo2($arr); echo foo2($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Is0AS
function name:  (null)
number of ops:  10
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   23     1        INIT_FCALL                                               'foo2'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
   24     5        INIT_FCALL                                               'foo2'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $3      
          8        ECHO                                                     $3
          9      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/Is0AS
function name:  foo
number of ops:  11
compiled vars:  !0 = $arr, !1 = $result, !2 = $el
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        ASSIGN                                                   !1, <array>
    8     2      > FE_RESET_R                                       $4      !0, ->8
          3    > > FE_FETCH_R                                               $4, !2, ->8
    9     4    >   MUL                                              ~6      !2, 2
          5        ASSIGN_DIM                                               !1
          6        OP_DATA                                                  ~6
    8     7      > JMP                                                      ->3
          8    >   FE_FREE                                                  $4
   13     9      > RETURN                                                   !1
   14    10*     > RETURN                                                   null

End of function foo

Function foo2:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 7
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 7
filename:       /in/Is0AS
function name:  foo2
number of ops:  9
compiled vars:  !0 = $arr, !1 = $result, !2 = $el
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
   17     2        ASSIGN                                                   !1, <array>
   18     3      > FE_RESET_R                                       $4      !0, ->7
          4    > > FE_FETCH_R                                               $4, !2, ->7
   19     5    >   YIELD                                                    !2
   18     6      > JMP                                                      ->4
          7    >   FE_FREE                                                  $4
   21     8      > GENERATOR_RETURN                                         

End of function foo2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
188.3 ms | 1403 KiB | 15 Q