$cant) { if ($gan == null || $cant > $cantGan || ($cant == $cantGan && $type < $gan)) { $gan = $type; $cantGan = $cant; } } echo $gan; ?>