3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ '1-2' => 'stuff', '3-4' => 'otherstuff', '2-1' => 'morestuff', '5-6' => 'evenmorestuff', '6-5' => 'evenmorestuffagain' ]; $result = array_unique(array_map(function ($key) { $parts = explode('-', $key); sort($parts); return implode('-', $parts); }, array_keys($array))); print_r($result);

preferences:
23.52 ms | 410 KiB | 5 Q