3v4l.org

run code in 500+ PHP versions simultaneously
<?php $numbers = [210, 11, 12]; $operators = ['-', '/']; $result = (array)($numbers[0] ?? []); foreach ($operators as $i => $operator) { array_push($result, $operator, $numbers[++$i]); } var_export($result); var_export( array_reduce( $operators, function($result, $value) use($numbers) { static $i = 0; array_push($result, $value, $numbers[++$i]); return $result; }, (array)($numbers[0] ?? []) ) );
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/YAJtu
function name:  (null)
number of ops:  37
compiled vars:  !0 = $numbers, !1 = $operators, !2 = $result, !3 = $operator, !4 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, <array>
    6     2        FETCH_DIM_IS                                         ~7      !0, 0
          3        COALESCE                                             ~8      ~7
          4        QM_ASSIGN                                            ~8      <array>
          5        CAST                                              7  ~9      ~8
          6        ASSIGN                                                       !2, ~9
    7     7      > FE_RESET_R                                           $11     !1, ->18
          8    > > FE_FETCH_R                                           ~12     $11, !3, ->18
          9    >   ASSIGN                                                       !4, ~12
    8    10        INIT_FCALL                                                   'array_push'
         11        SEND_REF                                                     !2
         12        SEND_VAR                                                     !3
         13        PRE_INC                                              ~14     !4
         14        FETCH_DIM_R                                          ~15     !0, ~14
         15        SEND_VAL                                                     ~15
         16        DO_ICALL                                                     
    7    17      > JMP                                                          ->8
         18    >   FE_FREE                                                      $11
   10    19        INIT_FCALL                                                   'var_export'
         20        SEND_VAR                                                     !2
         21        DO_ICALL                                                     
   12    22        INIT_FCALL                                                   'var_export'
   13    23        INIT_FCALL                                                   'array_reduce'
   14    24        SEND_VAR                                                     !1
   15    25        DECLARE_LAMBDA_FUNCTION                              ~18     [0]
         26        BIND_LEXICAL                                                 ~18, !0
   19    27        SEND_VAL                                                     ~18
   20    28        FETCH_DIM_IS                                         ~19     !0, 0
         29        COALESCE                                             ~20     ~19
         30        QM_ASSIGN                                            ~20     <array>
         31        CAST                                              7  ~21     ~20
         32        SEND_VAL                                                     ~21
   13    33        DO_ICALL                                             $22     
   20    34        SEND_VAR                                                     $22
   12    35        DO_ICALL                                                     
   22    36      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YAJtu
function name:  {closure:/in/YAJtu:15}
number of ops:  13
compiled vars:  !0 = $result, !1 = $value, !2 = $numbers, !3 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
   16     3        BIND_STATIC                                                  !3
   17     4        INIT_FCALL                                                   'array_push'
          5        SEND_REF                                                     !0
          6        SEND_VAR                                                     !1
          7        PRE_INC                                              ~4      !3
          8        FETCH_DIM_R                                          ~5      !2, ~4
          9        SEND_VAL                                                     ~5
         10        DO_ICALL                                                     
   18    11      > RETURN                                                       !0
   19    12*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.29 ms | 1881 KiB | 16 Q