- array_map: documentation ( source)
- print_r: documentation ( source)
- implode: documentation ( source)
- explode: documentation ( source)
- sort: documentation ( source)
- array_keys: documentation ( source)
- array_unique: documentation ( source)
<?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);