Warning: Division by zero in /var/customers/webs/stc/benchmark/index.php on line 256 Test: array_keys(array_flip) vs. array_unique

PHP Benchmarks

Performance comparison of PHP code alternatives.

Test: array_keys(array_flip()) vs. array_unique()

Do note that this test is only using integer values (which is common for this), long strings will take longer to hash as array keys.

Run Again Test Menu


Unfortunately, no history for this test is available.


The first test, "array_keys(array_flip())", was:

$array = array(1,2,3,4,5,6,7,8,9);
$a = 1;

if (in_array(1,$array) || $a)
	$b = true;

$array = array_keys(array_flip($array));

The second test, "array_unique()", was:

$array = array(1,2,3,4,5,6,7,8,9);
$a = 1;

if ($a || in_array(1,$array))
	$b = true;

Running: Linux (x86_64:1 GB) PHP (7.2.34-18+ubuntu16.04.1+deb.sury.org+1)