3v4l.org

run code in 300+ PHP versions simultaneously
<?php $constants = array( 'FOO' => 1, 'BAR' => 2, 'BAZ' => 3, 'FOO2' => 1, 'BAR2' => 2, 'BAZ2' => 3, ); echo 'max+array_count_values: '; $start = microtime(true); for($i=0; $i<1000; $i++) { $bool = (max(array_count_values($constants)) > 1); } $end = microtime(true); echo sprintf('%F', $end-$start) . PHP_EOL; echo 'count+array_unique+count: '; $start = microtime(true); for($i=0; $i<1000; $i++) { $bool = (count($constants) > count(array_unique($constants))); } $end = microtime(true); echo sprintf('%F', $end-$start) . PHP_EOL;

preferences:
32.09 ms | 402 KiB | 5 Q