3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr[] = ["_source" => ["block" => ["Kurud"], "district" => ["Dhamtari"], "state" => ["Chhattisgarh"]]]; $arr[] = ["_source" => ["block" => ["North-Bangeluru"], "district" => ["Bangalore"], "state" => ["Karnataka"]]]; $keys = array_keys($arr[0]["_source"]); $res[] = $keys; foreach($arr as $e) { $temp = []; foreach($keys as $k) $temp[] = $e["_source"][$k][0]; $res[] = $temp; } print_r($res);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 27
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 27
Branch analysis from position: 14
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 23
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 23
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/lsIS4
function name:  (null)
number of ops:  32
compiled vars:  !0 = $arr, !1 = $keys, !2 = $res, !3 = $e, !4 = $temp, !5 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN_DIM                                               !0
          1        OP_DATA                                                  <array>
    4     2        ASSIGN_DIM                                               !0
          3        OP_DATA                                                  <array>
    6     4        INIT_FCALL                                               'array_keys'
          5        FETCH_DIM_R                                      ~8      !0, 0
          6        FETCH_DIM_R                                      ~9      ~8, '_source'
          7        SEND_VAL                                                 ~9
          8        DO_ICALL                                         $10     
          9        ASSIGN                                                   !1, $10
    7    10        ASSIGN_DIM                                               !2
         11        OP_DATA                                                  !1
    8    12      > FE_RESET_R                                       $13     !0, ->27
         13    > > FE_FETCH_R                                               $13, !3, ->27
    9    14    >   ASSIGN                                                   !4, <array>
   10    15      > FE_RESET_R                                       $15     !1, ->23
         16    > > FE_FETCH_R                                               $15, !5, ->23
   11    17    >   FETCH_DIM_R                                      ~17     !3, '_source'
         18        FETCH_DIM_R                                      ~18     ~17, !5
         19        FETCH_DIM_R                                      ~19     ~18, 0
         20        ASSIGN_DIM                                               !4
         21        OP_DATA                                                  ~19
   10    22      > JMP                                                      ->16
         23    >   FE_FREE                                                  $15
   12    24        ASSIGN_DIM                                               !2
         25        OP_DATA                                                  !4
    8    26      > JMP                                                      ->13
         27    >   FE_FREE                                                  $13
   15    28        INIT_FCALL                                               'print_r'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.12 ms | 956 KiB | 15 Q