3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = array (0, 1, 1, 2, 0.5, 0.5); $counts = array_count_values(array_map('strval', $array)); $mode = array_search(max($counts), $counts); echo $mode; echo PHP_EOL; var_dump(isBiModal($counts)); function isBiModal($counts) { $match = max($counts); $filtered = array_filter($counts, function($el) use($match) { return $el === $match; }); return count($filtered) > 1; }
based on aVj2c
Output for 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.28 - 7.2.9
1 bool(true)