3v4l.org

run code in 300+ PHP versions simultaneously
<?php $finalArr = array(); $newArr = array( 'title' => 'lorem', 'vehicles' => array( // New dimension added here array( 'type' => 'sedan', 'price' => 2900, ), ) ); array_push($finalArr, $newArr); $index = array_search('lorem', array_column($finalArr, 'title')); $addArr = array( 'type' => 'truck', 'price' => 4750 ); array_push($finalArr[$index]['vehicles'], $addArr); print_r($finalArr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oT0CI
function name:  (null)
number of ops:  26
compiled vars:  !0 = $finalArr, !1 = $newArr, !2 = $index, !3 = $addArr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
   14     2        INIT_FCALL                                               'array_push'
          3        SEND_REF                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                                 
   16     6        INIT_FCALL                                               'array_search'
          7        SEND_VAL                                                 'lorem'
          8        INIT_FCALL                                               'array_column'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 'title'
         11        DO_ICALL                                         $7      
         12        SEND_VAR                                                 $7
         13        DO_ICALL                                         $8      
         14        ASSIGN                                                   !2, $8
   18    15        ASSIGN                                                   !3, <array>
   23    16        INIT_FCALL                                               'array_push'
         17        FETCH_DIM_W                                      $11     !0, !2
         18        FETCH_DIM_W                                      $12     $11, 'vehicles'
         19        SEND_REF                                                 $12
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                                 
   25    22        INIT_FCALL                                               'print_r'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.68 ms | 1001 KiB | 17 Q