3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [ [ "id" => '1', "order" => '123238' ], [ "id" => '2', "order" => '33278' ], [ "id" => '3', "order" => '8892372' ] ]; $arr2 = [ [ "id" => '1', "order" => '349483' ], [ "id" => '2', "order" => '9837283' ], [ "id" => '3', "order" => '33278' ] ]; $intersect = array_uintersect($arr1, $arr2, function ($a, $b) { return strcmp($a['order'], $b['order']); }); print_r($intersect); $notInArr1 = array_uintersect($arr1, $arr2, function ($a, $b) { if ($a["order"] === $b["order"]) return -1; if ($a["order"] > $b["order"]) return 1; return 0; }); print_r($notInArr1); $notInArr2 = array_uintersect($arr2, $arr1, function ($a, $b) { if ($a["order"] === $b["order"]) return -1; if ($a["order"] > $b["order"]) return 1; return 0; }); print_r($notInArr2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BWZEK
function name:  (null)
number of ops:  33
compiled vars:  !0 = $arr1, !1 = $arr2, !2 = $intersect, !3 = $notInArr1, !4 = $notInArr2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   18     1        ASSIGN                                                   !1, <array>
   33     2        INIT_FCALL                                               'array_uintersect'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
   35     6        SEND_VAL                                                 ~7
   33     7        DO_ICALL                                         $8      
          8        ASSIGN                                                   !2, $8
   37     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
   39    12        INIT_FCALL                                               'array_uintersect'
         13        SEND_VAR                                                 !0
         14        SEND_VAR                                                 !1
         15        DECLARE_LAMBDA_FUNCTION                          ~11     [1]
   43    16        SEND_VAL                                                 ~11
   39    17        DO_ICALL                                         $12     
         18        ASSIGN                                                   !3, $12
   45    19        INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                                 
   47    22        INIT_FCALL                                               'array_uintersect'
         23        SEND_VAR                                                 !1
         24        SEND_VAR                                                 !0
         25        DECLARE_LAMBDA_FUNCTION                          ~15     [2]
   51    26        SEND_VAL                                                 ~15
   47    27        DO_ICALL                                         $16     
         28        ASSIGN                                                   !4, $16
   53    29        INIT_FCALL                                               'print_r'
         30        SEND_VAR                                                 !4
         31        DO_ICALL                                                 
         32      > 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/BWZEK
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   34     2        INIT_FCALL                                               'strcmp'
          3        FETCH_DIM_R                                      ~2      !0, 'order'
          4        SEND_VAL                                                 ~2
          5        FETCH_DIM_R                                      ~3      !1, 'order'
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                         $4      
          8      > RETURN                                                   $4
   35     9*     > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BWZEK
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   40     2        FETCH_DIM_R                                      ~2      !0, 'order'
          3        FETCH_DIM_R                                      ~3      !1, 'order'
          4        IS_IDENTICAL                                             ~2, ~3
          5      > JMPZ                                                     ~4, ->7
          6    > > RETURN                                                   -1
   41     7    >   FETCH_DIM_R                                      ~5      !0, 'order'
          8        FETCH_DIM_R                                      ~6      !1, 'order'
          9        IS_SMALLER                                               ~6, ~5
         10      > JMPZ                                                     ~7, ->12
         11    > > RETURN                                                   1
   42    12    > > RETURN                                                   0
   43    13*     > RETURN                                                   null

End of Dynamic Function 1

Dynamic Function 2
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BWZEK
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   48     2        FETCH_DIM_R                                      ~2      !0, 'order'
          3        FETCH_DIM_R                                      ~3      !1, 'order'
          4        IS_IDENTICAL                                             ~2, ~3
          5      > JMPZ                                                     ~4, ->7
          6    > > RETURN                                                   -1
   49     7    >   FETCH_DIM_R                                      ~5      !0, 'order'
          8        FETCH_DIM_R                                      ~6      !1, 'order'
          9        IS_SMALLER                                               ~6, ~5
         10      > JMPZ                                                     ~7, ->12
         11    > > RETURN                                                   1
   50    12    > > RETURN                                                   0
   51    13*     > RETURN                                                   null

End of Dynamic Function 2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
277.31 ms | 1021 KiB | 16 Q