3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrays = [ [ "id" => 1, "order_id" => 1, "image_url" => "/resources/filename1" ], [ "id" => 2, "order_id" => 1, "image_url" => "/resources/filename2" ] ]; $start = array_shift($arrays); $start['image_url'] = [$start['image_url']]; var_dump($start); $arrays = array_reduce($arrays, function($carry, $item) { $carry['image_url'][] = $item['image_url']; return $carry; }, $start); print_r($arrays);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PTDlk
function name:  (null)
number of ops:  23
compiled vars:  !0 = $arrays, !1 = $start
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   14     1        INIT_FCALL                                               'array_shift'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
   15     5        FETCH_DIM_R                                      ~6      !1, 'image_url'
          6        INIT_ARRAY                                       ~7      ~6
          7        ASSIGN_DIM                                               !1, 'image_url'
          8        OP_DATA                                                  ~7
   16     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   18    12        INIT_FCALL                                               'array_reduce'
         13        SEND_VAR                                                 !0
         14        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FPTDlk%3A18%240'
   21    15        SEND_VAL                                                 ~9
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $10     
   18    18        ASSIGN                                                   !0, $10
   23    19        INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FPTDlk%3A18%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PTDlk
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $carry, !1 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2        FETCH_DIM_R                                      ~4      !1, 'image_url'
          3        FETCH_DIM_W                                      $2      !0, 'image_url'
          4        ASSIGN_DIM                                               $2
          5        OP_DATA                                                  ~4
   20     6      > RETURN                                                   !0
   21     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FPTDlk%3A18%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.46 ms | 1396 KiB | 21 Q