3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [ '0' => ['name'=>'Apple', 'id' => 1], '1' => ['name'=>'Banana', 'id' => 2], '2' => ['name' => 'orange', 'id' => 3], ]; $b = [ '0' => ['price'=> 20, 'a_id' => 2], '1' => ['price'=> 10, 'a_id' => 3], '3' => ['price'=> 30, 'a_id' => 1], ]; $result = array_column($a, null, 'id'); foreach ($b as ['a_id' => $a_id, 'price' => $result[$a_id]['price']]); var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/nXhVG
function name:  (null)
number of ops:  26
compiled vars:  !0 = $a, !1 = $b, !2 = $result, !3 = $a_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, <array>
   14     2        INIT_FCALL                                               'array_column'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 null
          5        SEND_VAL                                                 'id'
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !2, $6
   15     8      > FE_RESET_R                                       $8      !1, ->18
          9    > > FE_FETCH_R                                               $8, $9, ->18
         10    >   FETCH_LIST_R                                     $10     $9, 'a_id'
         11        ASSIGN                                                   !3, $10
         12        FETCH_LIST_R                                     $12     $9, 'price'
         13        FETCH_DIM_W                                      $13     !2, !3
         14        ASSIGN_DIM                                               $13, 'price'
         15        OP_DATA                                                  $12
         16        FREE                                                     $9
         17      > JMP                                                      ->9
         18    >   FE_FREE                                                  $8
   16    19        INIT_FCALL                                               'var_export'
         20        INIT_FCALL                                               'array_values'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $15     
         23        SEND_VAR                                                 $15
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.59 ms | 1000 KiB | 16 Q