<?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;
- Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.19
- Parse error: syntax error, unexpected ';' in /in/2W8kr on line 15
Process exited with code 255.
preferences:
174.82 ms | 1395 KiB | 55 Q