3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ "elem-1" => ["title" => "1", "desc" => ""], "elem-2" => ["title" => "2", "desc" => ""], "elem-3" => ["title" => "3", "desc" => ""], "elem-4" => ["title" => "4", "desc" => ""], ]; $result = []; array_walk( $arr, function($row, $key) use(&$result) { $result[] = [$key => $row['title']]; } ); var_export($result); echo "\n---\n"; $result = []; foreach ($arr as $key => $row) { $result[] = [$key => $row['title']]; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 21
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/vBi9H
function name:  (null)
number of ops:  26
compiled vars:  !0 = $arr, !1 = $result, !2 = $row, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   11     2        INIT_FCALL                                               'array_walk'
   12     3        SEND_REF                                                 !0
   13     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FvBi9H%3A13%240'
          5        BIND_LEXICAL                                             ~6, !1
   15     6        SEND_VAL                                                 ~6
          7        DO_ICALL                                                 
   17     8        INIT_FCALL                                               'var_export'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
   19    11        ECHO                                                     '%0A---%0A'
   21    12        ASSIGN                                                   !1, <array>
   22    13      > FE_RESET_R                                       $10     !0, ->21
         14    > > FE_FETCH_R                                       ~11     $10, !2, ->21
         15    >   ASSIGN                                                   !3, ~11
   23    16        FETCH_DIM_R                                      ~14     !2, 'title'
         17        INIT_ARRAY                                       ~15     ~14, !3
         18        ASSIGN_DIM                                               !1
         19        OP_DATA                                                  ~15
   22    20      > JMP                                                      ->14
         21    >   FE_FREE                                                  $10
   25    22        INIT_FCALL                                               'var_export'
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FvBi9H%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vBi9H
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $row, !1 = $key, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   14     3        FETCH_DIM_R                                      ~4      !0, 'title'
          4        INIT_ARRAY                                       ~5      ~4, !1
          5        ASSIGN_DIM                                               !2
          6        OP_DATA                                                  ~5
   15     7      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FvBi9H%3A13%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.41 ms | 1396 KiB | 17 Q