3v4l.org

run code in 300+ 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}
number of ops:  9
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        INIT_FCALL                                               'in_array'
          3        FETCH_DIM_R                                      ~2      !0, 'invoice_number'
          4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
   29     8*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.1 ms | 1006 KiB | 17 Q