3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result = []; $compare_arr = [ ["venue1" => 1, "venue2" => 2], ["venue1" => 3, "venue2" => 4], ["venue1" => 2, "venue2" => 1], ["venue1" => 5, "venue2" => 6], ["venue1" => 7, "venue2" => 7], ["venue1" => 7, "venue2" => 7], ["venue1" => 7, "venue2" => 7], ["venue1" => 2, "venue2" => 1], ["venue1" => 2, "venue2" => 1], ["venue1" => 99, "venue2" => 200], ["venue1" => 200, "venue2" => 99], ]; foreach ($compare_arr as $v1) { sort($v1); $cKey = $v1[0] .'-'. $v1[1]; if (array_key_exists($cKey, $result)) { $result[$cKey][] = $v1; continue; } $result[$cKey] = $v1; } $result = array_filter($result, function($item) { return count($item) === 2; }); print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/I060q
function name:  (null)
number of ops:  32
compiled vars:  !0 = $result, !1 = $compare_arr, !2 = $v1, !3 = $cKey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
   18     2      > FE_RESET_R                                       $6      !1, ->21
          3    > > FE_FETCH_R                                               $6, !2, ->21
   19     4    >   INIT_FCALL                                               'sort'
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
   20     7        FETCH_DIM_R                                      ~8      !2, 0
          8        CONCAT                                           ~9      ~8, '-'
          9        FETCH_DIM_R                                      ~10     !2, 1
         10        CONCAT                                           ~11     ~9, ~10
         11        ASSIGN                                                   !3, ~11
   21    12        ARRAY_KEY_EXISTS                                         !3, !0
         13      > JMPZ                                                     ~13, ->18
   22    14    >   FETCH_DIM_W                                      $14     !0, !3
         15        ASSIGN_DIM                                               $14
         16        OP_DATA                                                  !2
   23    17      > JMP                                                      ->3
   25    18    >   ASSIGN_DIM                                               !0, !3
         19        OP_DATA                                                  !2
   18    20      > JMP                                                      ->3
         21    >   FE_FREE                                                  $6
   27    22        INIT_FCALL                                               'array_filter'
         23        SEND_VAR                                                 !0
         24        DECLARE_LAMBDA_FUNCTION                          ~17     [0]
   29    25        SEND_VAL                                                 ~17
   27    26        DO_ICALL                                         $18     
         27        ASSIGN                                                   !0, $18
   31    28        INIT_FCALL                                               'print_r'
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                                 
         31      > 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/I060q
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   28     1        COUNT                                            ~1      !0
          2        IS_IDENTICAL                                     ~2      ~1, 2
          3      > RETURN                                                   ~2
   29     4*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.24 ms | 1017 KiB | 16 Q