$variable = array_count_values($result); if ($variable[a] > $variable[b]) { echo "a es mayor que b"; }