3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array1 = [ [ "transaction_id" => 62369600431, "invoice_number" => 37161 ], [ "transaction_id" => 62369595048, "invoice_number" => 37346 ], [ "transaction_id" => 62369600431, "invoice_number" => 38064 ] ]; $array2 = [ [ "invoice_number" => 37161 ], [ "invoice_number" => 37346 ] ]; $invoiceNumbers = array_column($array2, "invoice_number"); $result = array_filter($array1, function($x) use ($invoiceNumbers) { return in_array($x["invoice_number"], $invoiceNumbers); }); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/486fu
function name:  (null)
number of ops:  18
compiled vars:  !0 = $array1, !1 = $array2, !2 = $invoiceNumbers, !3 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   18     1        ASSIGN                                                       !1, <array>
   26     2        INIT_FCALL                                                   'array_column'
          3        SEND_VAR                                                     !1
          4        SEND_VAL                                                     'invoice_number'
          5        DO_ICALL                                             $6      
          6        ASSIGN                                                       !2, $6
   27     7        INIT_FCALL                                                   'array_filter'
          8        SEND_VAR                                                     !0
          9        DECLARE_LAMBDA_FUNCTION                              ~8      [0]
         10        BIND_LEXICAL                                                 ~8, !2
   29    11        SEND_VAL                                                     ~8
   27    12        DO_ICALL                                             $9      
         13        ASSIGN                                                       !3, $9
   31    14        INIT_FCALL                                                   'print_r'
         15        SEND_VAR                                                     !3
         16        DO_ICALL                                                     
         17      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/486fu
function name:  {closure:/in/486fu:27}
number of ops:  6
compiled vars:  !0 = $x, !1 = $invoiceNumbers
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   27     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
   28     2        FETCH_DIM_R                                          ~2      !0, 'invoice_number'
          3        FRAMELESS_ICALL_2                in_array            ~3      ~2, !1
          4      > RETURN                                                       ~3
   29     5*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.45 ms | 2160 KiB | 16 Q