3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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 * 2); } } echo foo2($arr); echo foo2($arr);
based on uD0FN
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hoq1M
function name:  (null)
number of ops:  12
compiled vars:  !0 = $arr
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   ASSIGN                                                   !0, <array>
   6     1        NOP                                                      
  16     2        NOP                                                      
  23     3        INIT_FCALL                                               'foo2'
         4        SEND_VAR                                                 !0
         5        DO_FCALL                                      0  $2      
         6        ECHO                                                     $2
  24     7        INIT_FCALL                                               'foo2'
         8        SEND_VAR                                                 !0
         9        DO_FCALL                                      0  $3      
        10        ECHO                                                     $3
        11      > 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/hoq1M
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
         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 = 8
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 8
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 8
filename:       /in/hoq1M
function name:  foo2
number of ops:  10
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, ->8
         4    > > FE_FETCH_R                                               $4, !2, ->8
  19     5    >   MUL                                              ~5      !2, 2
         6        YIELD                                                    ~5
         7      > JMP                                                      ->4
         8    >   FE_FREE                                                  $4
  21     9      > GENERATOR_RETURN                                         

End of function foo2

Generated using Vulcan Logic Dumper, using php 7.3.0