3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr=Array ( 0 => Array ( "Title" => "La science des rĂªves", "Year" => "2006", "Director" => Array ( "Name" => "Michel Gondry", "BirthYear" => "1963", "BirthPlace" => "Versailles, Yvelines, France" ) ), 1 => Array ( "Title" => "Arizona Dream", "Year" => "1992", "Director" => Array ( "Name" => "Emir Kusturica", "BirthYear" => "1954", "BirthPlace" => "Sarajevo, Bosnia and Herzegovina, Yugoslavia" ) ) ); $ck=Array ( 0 => "Title", 1 => "Director.Name", 2 => "Director.BirthYear" ); $newarray=array(); $s=sizeof($arr); $ss=0; foreach($ck as $ck2) { while($ss<$s) { $k = explode(".",$ck2); if(sizeof($k) >1) $newarray[$ss][$ck2]=$arr[$ss][$k[0]][$k[1]]; else $newarray[$ss][$ck2]=$arr[$ss][$k[0]]; $ss++; } } print_r($newarray);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 36
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 36
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 9
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 26
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 9
Branch analysis from position: 35
Branch analysis from position: 9
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 9
Branch analysis from position: 35
Branch analysis from position: 9
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/TdXj1
function name:  (null)
number of ops:  41
compiled vars:  !0 = $arr, !1 = $ck, !2 = $newarray, !3 = $s, !4 = $ss, !5 = $ck2, !6 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   33     1        ASSIGN                                                   !1, <array>
   41     2        ASSIGN                                                   !2, <array>
   42     3        COUNT                                            ~10     !0
          4        ASSIGN                                                   !3, ~10
   43     5        ASSIGN                                                   !4, 0
   44     6      > FE_RESET_R                                       $13     !1, ->36
          7    > > FE_FETCH_R                                               $13, !5, ->36
   46     8    > > JMP                                                      ->33
   48     9    >   INIT_FCALL                                               'explode'
         10        SEND_VAL                                                 '.'
         11        SEND_VAR                                                 !5
         12        DO_ICALL                                         $14     
         13        ASSIGN                                                   !6, $14
   49    14        COUNT                                            ~16     !6
         15        IS_SMALLER                                               1, ~16
         16      > JMPZ                                                     ~17, ->26
   50    17    >   FETCH_DIM_R                                      ~21     !6, 0
         18        FETCH_DIM_R                                      ~23     !6, 1
         19        FETCH_DIM_R                                      ~20     !0, !4
         20        FETCH_DIM_R                                      ~22     ~20, ~21
         21        FETCH_DIM_R                                      ~24     ~22, ~23
         22        FETCH_DIM_W                                      $18     !2, !4
         23        ASSIGN_DIM                                               $18, !5
         24        OP_DATA                                                  ~24
         25      > JMP                                                      ->32
   52    26    >   FETCH_DIM_R                                      ~28     !6, 0
         27        FETCH_DIM_R                                      ~27     !0, !4
         28        FETCH_DIM_R                                      ~29     ~27, ~28
         29        FETCH_DIM_W                                      $25     !2, !4
         30        ASSIGN_DIM                                               $25, !5
         31        OP_DATA                                                  ~29
   54    32    >   PRE_INC                                                  !4
   46    33    >   IS_SMALLER                                               !4, !3
         34      > JMPNZ                                                    ~31, ->9
   44    35    > > JMP                                                      ->7
         36    >   FE_FREE                                                  $13
   58    37        INIT_FCALL                                               'print_r'
         38        SEND_VAR                                                 !2
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.23 ms | 1400 KiB | 17 Q