3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ '12345', '23457' ]; $array2 = [ ['id' => '12345', 'fake_data' => 'something'], ['id' => '23457', 'more_data' => 'something else'], ['id' => '76389','more_data' => 'something else 3'], ['id' => '10293', 'more_data' => 'something else 4'], ['id' => '09229', 'more_data' => 'something else 5'] ]; $found_id_rows = array_filter($array2, function($row) use($array1) { return in_array($row['id'], $array1); }); $not_found_id_rows = array_filter($array2, function($row) use($array1) { return !in_array($row['id'], $array1); }); print_r($found_id_rows); print_r($not_found_id_rows);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6OVjP
function name:  (null)
number of ops:  23
compiled vars:  !0 = $array1, !1 = $array2, !2 = $found_id_rows, !3 = $not_found_id_rows
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, <array>
   16     2        INIT_FCALL                                               'array_filter'
          3        SEND_VAR                                                 !1
          4        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
          5        BIND_LEXICAL                                             ~6, !0
   18     6        SEND_VAL                                                 ~6
   16     7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !2, $7
   20     9        INIT_FCALL                                               'array_filter'
         10        SEND_VAR                                                 !1
         11        DECLARE_LAMBDA_FUNCTION                          ~9      [1]
         12        BIND_LEXICAL                                             ~9, !0
   22    13        SEND_VAL                                                 ~9
   20    14        DO_ICALL                                         $10     
         15        ASSIGN                                                   !3, $10
   24    16        INIT_FCALL                                               'print_r'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
   25    19        INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                                 
         22      > 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/6OVjP
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $row, !1 = $array1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   17     2        INIT_FCALL                                               'in_array'
          3        FETCH_DIM_R                                      ~2      !0, 'id'
          4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
   18     8*     > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6OVjP
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $row, !1 = $array1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   21     2        INIT_FCALL                                               'in_array'
          3        FETCH_DIM_R                                      ~2      !0, 'id'
          4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $3      
          7        BOOL_NOT                                         ~4      $3
          8      > RETURN                                                   ~4
   22     9*     > RETURN                                                   null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.69 ms | 1009 KiB | 16 Q