fork(2) download
  1. <?php
  2. foreach ($ary=array("○", "○", "○", "△", "△", "☓") as $val1)
  3. foreach ($ary as $val2)
  4. $a[$x=$val1>$val2?$val1.$val2:$val2.$val1] = isset($a[$x]) ? ++$a[$x] : 1;
  5. arsort($a);
  6. print_r($a);
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Array
(
    [○△] => 12
    [○○] => 9
    [☓○] => 6
    [△△] => 4
    [☓△] => 4
    [☓☓] => 1
)