ForeachUniqueInArrayTest

Create an array without duplicates from a range using foreach, checking existing with in_array and keys as values


<?php 

$values 
$this->getRangeStrings($loop);

$this->start($loop);

$unique = array();

foreach (
$values as $value) {
    if (!
in_array($value$unique)) {
        
$unique[] = $value;
    }
}

return 
$this->end();
PHP Loops Seconds Percent
8.3.13 100.000 4.574754 +208%
8.3.10 100.000 3.984533 +181%
8.3.9 100.000 3.730549 +169%
7.3.33 100.000 2.943048 +134%
7.3.31 100.000 2.510981 +114%
7.3.30 100.000 2.487157 +113%
7.3.29 100.000 2.517940 +114%
7.3.28 100.000 2.747878 +125%
7.3.27 100.000 3.051315 +139%
7.3.24 100.000 2.920956 +133%
7.3.23 100.000 3.171803 +144%
7.3.22 100.000 2.653903 +121%
7.3.19 100.000 3.106946 +141%
7.3.18 100.000 2.812209 +128%
7.3.17 100.000 2.671886 +121%
7.3.16 100.000 2.840029 +129%
7.3.15 100.000 2.337001 +106%
7.3.14 100.000 2.628391 +119%
7.3.13 100.000 2.683845 +122%
7.3.12 100.000 2.201023 100%
7.3.11 100.000 3.942755 +179%
7.3.9 100.000 5.112483 +232%
7.3.8 100.000 4.946211 +225%
7.2.29 100.000 3.477899 +158%
8.3.13 10.000 0.055283 +208%
7.2.34 100.000 4.174442 +190%
7.2.33 100.000 3.931031 +179%
7.2.31 100.000 3.818546 +173%
7.2.30 100.000 3.754172 +171%
8.3.10 10.000 0.044313 +166%
7.2.28 100.000 3.336568 +152%
7.2.27 100.000 3.518747 +160%
7.2.26 100.000 3.332493 +151%
7.2.25 100.000 3.141957 +143%
7.2.24 100.000 4.881359 +222%
7.2.22 100.000 6.123695 +278%
7.2.21 100.000 6.037400 +274%
7.1.33 100.000 4.039481 +184%
7.1.32 100.000 6.263284 +285%
7.1.31 100.000 6.108082 +278%
7.1.0 100.000 19.108908 +868%
7.0.33 100.000 4.147617 +188%
7.0.7 100.000 18.538888 +842%
5.6.40 100.000 28.821240 +1309%
5.6.22 100.000 79.505506 +3612%
5.5.36 100.000 82.791771 +3762%
5.4.45 100.000 77.334825 +3514%
5.3.29 100.000 72.680816 +3302%
8.3.9 10.000 0.041018 +154%
8.0.30 100.000 3.493155 +159%
8.0.29 100.000 3.021602 +137%
8.0.28 100.000 2.870065 +130%
8.0.27 100.000 3.187656 +145%
8.0.26 100.000 3.306859 +150%
8.0.25 100.000 3.247885 +148%
8.0.24 100.000 3.214957 +146%
8.0.23 100.000 3.317165 +151%
8.0.20 10.000 0.037924 +142%
8.0.20 100.000 3.331289 +151%
8.0.19 10.000 0.037630 +141%
8.0.19 100.000 2.898370 +132%
8.0.17 10.000 0.034329 +129%
8.0.17 100.000 2.892494 +131%
8.0.16 10.000 0.034645 +130%
8.0.16 100.000 2.991825 +136%
8.0.14 10.000 0.029187 +110%
8.0.14 100.000 2.705744 +123%
8.0.11 100.000 2.894771 +132%
8.0.10 100.000 2.407780 +109%
8.0.9 100.000 2.732731 +124%
8.0.8 100.000 2.778597 +126%
8.0.7 100.000 2.706058 +123%
8.0.3 100.000 3.044475 +138%
8.0.2 100.000 3.526083 +160%
8.0.0 100.000 2.585317 +117%
7.4.33 100.000 3.026360 +137%
7.4.32 100.000 3.125732 +142%
7.4.30 100.000 3.509076 +159%
7.4.28 100.000 2.856638 +130%
7.4.27 100.000 2.996438 +136%
7.4.24 100.000 2.463503 +112%
7.4.23 100.000 2.492321 +113%
7.4.22 100.000 2.794534 +127%
8.0.11 10.000 0.035525 +133%
8.0.10 10.000 0.031052 +117%
8.0.0 10.000 0.029088 +109%
7.4.29 100.000 3.568570 +162%
7.4.21 10.000 0.034391 +129%
7.4.21 100.000 2.551373 +116%
7.4.20 10.000 0.032609 +122%
7.4.20 100.000 2.443411 +111%
7.4.16 100.000 3.044103 +138%
7.4.15 100.000 3.483400 +158%
7.4.33 10.000 0.032811 +123%
7.4.32 10.000 0.036848 +138%
7.4.30 10.000 0.040151 +151%
7.4.29 10.000 0.044078 +165%
7.4.24 10.000 0.030036 +113%
7.4.23 10.000 0.032039 +120%
7.4.22 10.000 0.033415 +125%
7.4.13 100.000 2.741903 +125%
7.4.12 100.000 2.965387 +135%
7.4.11 100.000 3.125079 +142%
7.4.10 100.000 2.933453 +133%
8.0.2 10.000 0.042294 +159%
7.4.0 100.000 4.402097 +200%
8.0.30 10.000 0.039255 +147%
8.0.29 10.000 0.034358 +129%
8.0.28 10.000 0.032390 +122%
8.0.27 10.000 0.035693 +134%
8.0.26 10.000 0.035799 +134%
8.0.25 10.000 0.038033 +143%
8.0.24 10.000 0.037675 +141%
8.0.23 10.000 0.037038 +139%
8.0.9 10.000 0.034046 +128%
8.0.8 10.000 0.033142 +124%
8.0.7 10.000 0.035532 +133%
8.0.3 10.000 0.040409 +152%
7.4.28 10.000 0.035240 +132%
7.4.27 10.000 0.034512 +130%
7.4.16 10.000 0.040714 +153%
7.4.15 10.000 0.045676 +171%
7.4.13 10.000 0.030905 +116%
7.4.12 10.000 0.030427 +114%
7.4.11 10.000 0.037124 +139%
7.4.10 10.000 0.033147 +124%
7.4.7 10.000 0.030257 +114%
7.4.7 100.000 2.776209 +126%
7.4.6 10.000 0.035002 +131%
7.4.6 100.000 2.807946 +128%
7.4.5 10.000 0.034197 +128%
7.4.5 100.000 2.874791 +131%
7.4.4 10.000 0.031988 +120%
7.4.4 100.000 2.777948 +126%
7.4.3 10.000 0.035805 +134%
7.4.3 100.000 2.766638 +126%
7.4.1 100.000 2.500698 +114%
7.4.2 10.000 0.035789 +134%
7.4.2 100.000 2.947368 +134%
7.4.1 10.000 0.033690 +126%
7.4.0 10.000 0.049508 +186%
7.3.33 10.000 0.033270 +125%
7.3.31 10.000 0.030672 +115%
7.3.30 10.000 0.031784 +119%
7.3.29 10.000 0.030713 +115%
7.3.28 10.000 0.034349 +129%
7.3.27 10.000 0.039245 +147%
7.3.24 10.000 0.033515 +126%
7.3.23 10.000 0.034895 +131%
7.3.22 10.000 0.026962 +101%
7.3.19 10.000 0.035362 +133%
7.3.18 10.000 0.034127 +128%
7.3.17 10.000 0.030096 +113%
7.3.16 10.000 0.034342 +129%
7.3.15 10.000 0.027326 +103%
7.3.14 10.000 0.033396 +125%
7.3.13 10.000 0.034498 +130%
7.3.12 10.000 0.026635 100%
7.3.11 10.000 0.042629 +160%
7.3.9 10.000 0.055932 +210%
7.3.8 10.000 0.054684 +205%
7.2.34 10.000 0.041070 +154%
7.2.33 10.000 0.039677 +149%
7.2.31 10.000 0.038273 +144%
7.2.30 10.000 0.038116 +143%
7.2.29 10.000 0.036278 +136%
7.2.28 10.000 0.038556 +145%
7.2.27 10.000 0.037934 +142%
7.2.26 10.000 0.037596 +141%
7.2.25 10.000 0.033712 +127%
7.2.24 10.000 0.046341 +174%
7.2.22 10.000 0.058718 +220%
7.2.21 10.000 0.058505 +220%
7.1.33 10.000 0.040175 +151%
7.1.32 10.000 0.060032 +225%
7.1.31 10.000 0.060258 +226%
7.1.0 10.000 0.185585 +697%
7.0.33 10.000 0.039446 +148%
7.0.7 10.000 0.179088 +672%
5.6.40 10.000 0.170580 +640%
5.6.22 10.000 0.686117 +2576%
5.5.36 10.000 0.716231 +2689%
5.4.45 10.000 0.660133 +2478%
5.3.29 10.000 0.636841 +2391%