3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [0 => "TEST ", 1 => "1 ", 2 => "2 ", 3 => "3 "]; $temp = array_shift($arr); $res = []; foreach ($arr as $key => $value) { $res[] = ["NAME" => $temp, "VALUE" => $value]; } print_r($res);die;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 14
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 14
filename:       /in/JVqHf
function name:  (null)
number of ops:  20
compiled vars:  !0 = $arr, !1 = $temp, !2 = $res, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        INIT_FCALL                                               'array_shift'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                         $6      
          4        ASSIGN                                                   !1, $6
    4     5        ASSIGN                                                   !2, <array>
    5     6      > FE_RESET_R                                       $9      !0, ->14
          7    > > FE_FETCH_R                                       ~10     $9, !3, ->14
          8    >   ASSIGN                                                   !4, ~10
    6     9        INIT_ARRAY                                       ~13     !1, 'NAME'
         10        ADD_ARRAY_ELEMENT                                ~13     !3, 'VALUE'
         11        ASSIGN_DIM                                               !2
         12        OP_DATA                                                  ~13
    5    13      > JMP                                                      ->7
         14    >   FE_FREE                                                  $9
    8    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                                 
         18      > EXIT                                                     
    9    19*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.69 ms | 998 KiB | 15 Q