3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ ['id' => 1, 'name' => 'tanaka'], ['id' => 2, 'name' => 'yamada'], ['id' => 3, 'name' => 'yosida'], ['id' => 4, 'name' => 'yosida'] ]; $array2 = [1,3]; $name_list = array_values(array_intersect_key(array_column($array1, 'name', 'id'), array_flip($array2))); var_dump($name_list);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tAcbt
function name:  (null)
number of ops:  22
compiled vars:  !0 = $array1, !1 = $array2, !2 = $name_list
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   11     2        INIT_FCALL                                               'array_values'
          3        INIT_FCALL                                               'array_intersect_key'
          4        INIT_FCALL                                               'array_column'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 'name'
          7        SEND_VAL                                                 'id'
          8        DO_ICALL                                         $5      
          9        SEND_VAR                                                 $5
         10        INIT_FCALL                                               'array_flip'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                         $7      
         15        SEND_VAR                                                 $7
         16        DO_ICALL                                         $8      
         17        ASSIGN                                                   !2, $8
   13    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.36 ms | 1395 KiB | 23 Q