3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function arraydiff(&$array1, &$array2) { $a1 = array_flip($array1); $a2 = array_flip($array2); $differences = array(); //what is in array 1 that is not in array2 $c = count($a1); foreach ($a1 as $k => $v) { if (!isset($a2[$k])) { $differences[] = $k; } } return $differences; } $i=0; $j=500000; while($i < 60000) { $i++; $j++; $data1[] = md5($i); $data2[] = md5($j); } $time = microtime(true); echo "Starting arraydiff\n"; $data_diff1 = arraydiff($data1, $data2); $time = microtime(true) - $time; echo 'arraydiff() took ' . number_format($time, 3) . ' seconds and returned ' . count($data_diff1) . " entries\n";
Output for hhvm-3.10.0, 7.0.4, 7.1.0
Starting arraydiff arraydiff() took 0.017 seconds and returned 60000 entries
Output for 7.0.14
Starting arraydiff arraydiff() took -0.018 seconds and returned 60000 entries
Output for 7.0.6
Starting arraydiff arraydiff() took 0.031 seconds and returned 60000 entries
Output for 7.0.0, 7.0.5
Starting arraydiff arraydiff() took 0.018 seconds and returned 60000 entries
Output for 7.0.2 - 7.0.3
Starting arraydiff arraydiff() took 0.024 seconds and returned 60000 entries
Output for 7.0.1
Starting arraydiff arraydiff() took 0.016 seconds and returned 60000 entries
Output for hhvm-3.12.0
Starting arraydiff
Process exited with code 137.
Output for 5.4.32, 5.5.25, 5.6.16, 5.6.20, 5.6.28
Starting arraydiff arraydiff() took 0.069 seconds and returned 60000 entries
Output for 5.4.30, 5.6.8, 5.6.21
Starting arraydiff arraydiff() took 0.071 seconds and returned 60000 entries
Output for 5.5.28, 5.6.10, 5.6.15, 5.6.17 - 5.6.19
Starting arraydiff arraydiff() took 0.068 seconds and returned 60000 entries
Output for 5.5.26, 5.5.35, 5.6.14
Starting arraydiff arraydiff() took 0.060 seconds and returned 60000 entries
Output for 5.5.30, 5.6.13
Starting arraydiff arraydiff() took 0.063 seconds and returned 60000 entries
Output for 5.5.29, 5.5.31, 5.5.34, 5.6.12
Starting arraydiff arraydiff() took 0.067 seconds and returned 60000 entries
Output for 5.6.11
Starting arraydiff arraydiff() took 0.072 seconds and returned 60000 entries
Output for 5.4.31, 5.4.44, 5.5.27, 5.6.9
Starting arraydiff arraydiff() took 0.070 seconds and returned 60000 entries
Output for 5.5.33
Starting arraydiff arraydiff() took 0.062 seconds and returned 60000 entries
Output for 5.5.32
Starting arraydiff arraydiff() took 0.064 seconds and returned 60000 entries
Output for 5.3.0, 5.3.13, 5.3.16, 5.3.29 - 5.4.0, 5.4.11, 5.4.22, 5.5.24
Starting arraydiff arraydiff() took 0.084 seconds and returned 60000 entries
Output for 5.3.21, 5.3.24, 5.4.29, 5.4.45
Starting arraydiff arraydiff() took 0.073 seconds and returned 60000 entries
Output for 5.4.43
Starting arraydiff arraydiff() took 0.119 seconds and returned 60000 entries
Output for 5.1.4, 5.2.2, 5.4.42
Starting arraydiff arraydiff() took 0.099 seconds and returned 60000 entries
Output for 4.3.3, 4.3.11, 5.4.41
Starting arraydiff arraydiff() took 0.124 seconds and returned 60000 entries
Output for 5.4.40
Starting arraydiff arraydiff() took 0.125 seconds and returned 60000 entries
Output for 5.0.0, 5.4.39
Starting arraydiff arraydiff() took 0.172 seconds and returned 60000 entries
Output for 5.4.38
Starting arraydiff arraydiff() took 0.338 seconds and returned 60000 entries
Output for 5.4.37
Starting arraydiff arraydiff() took 0.165 seconds and returned 60000 entries
Output for 5.4.36
Starting arraydiff arraydiff() took 0.156 seconds and returned 60000 entries
Output for 5.4.35
Starting arraydiff arraydiff() took 0.153 seconds and returned 60000 entries
Output for 4.4.8, 5.4.34
Starting arraydiff arraydiff() took 0.148 seconds and returned 60000 entries
Output for 5.2.1, 5.3.1, 5.4.3, 5.4.8, 5.4.24, 5.4.28
Starting arraydiff arraydiff() took 0.076 seconds and returned 60000 entries
Output for 5.2.16, 5.3.2, 5.3.6 - 5.3.7, 5.3.10 - 5.3.11, 5.4.7, 5.4.9, 5.4.26 - 5.4.27
Starting arraydiff arraydiff() took 0.078 seconds and returned 60000 entries
Output for 5.2.13, 5.4.4, 5.4.16, 5.4.25
Starting arraydiff arraydiff() took 0.079 seconds and returned 60000 entries
Output for 5.2.17, 5.4.1, 5.4.23
Starting arraydiff arraydiff() took 0.085 seconds and returned 60000 entries
Output for 5.4.10, 5.4.21
Starting arraydiff arraydiff() took 0.102 seconds and returned 60000 entries
Output for 5.2.6, 5.3.5, 5.3.18, 5.3.25, 5.3.27, 5.4.6, 5.4.20
Starting arraydiff arraydiff() took 0.081 seconds and returned 60000 entries
Output for 5.4.19
Starting arraydiff arraydiff() took 0.092 seconds and returned 60000 entries
Output for 5.2.11, 5.2.14, 5.3.17, 5.4.13, 5.4.18
Starting arraydiff arraydiff() took 0.075 seconds and returned 60000 entries
Output for 5.2.8, 5.3.14 - 5.3.15, 5.4.17
Starting arraydiff arraydiff() took 0.082 seconds and returned 60000 entries
Output for 5.2.12, 5.3.9, 5.4.15
Starting arraydiff arraydiff() took 0.087 seconds and returned 60000 entries
Output for 5.4.14
Starting arraydiff arraydiff() took 0.097 seconds and returned 60000 entries
Output for 5.3.8, 5.3.12, 5.3.19 - 5.3.20, 5.4.12
Starting arraydiff arraydiff() took 0.080 seconds and returned 60000 entries
Output for 5.2.7, 5.3.22 - 5.3.23, 5.4.5
Starting arraydiff arraydiff() took 0.083 seconds and returned 60000 entries
Output for 5.4.2
Starting arraydiff arraydiff() took 0.088 seconds and returned 60000 entries
Output for 5.2.9, 5.2.15, 5.3.3, 5.3.26, 5.3.28
Starting arraydiff arraydiff() took 0.077 seconds and returned 60000 entries
Output for 5.3.4
Starting arraydiff arraydiff() took 0.090 seconds and returned 60000 entries
Output for 5.2.10
Starting arraydiff arraydiff() took 0.074 seconds and returned 60000 entries
Output for 5.1.6, 5.2.4 - 5.2.5
Starting arraydiff arraydiff() took 0.101 seconds and returned 60000 entries
Output for 5.1.2, 5.2.3
Starting arraydiff arraydiff() took 0.095 seconds and returned 60000 entries
Output for 5.2.0
Starting arraydiff arraydiff() took 0.111 seconds and returned 60000 entries
Output for 5.1.5
Starting arraydiff arraydiff() took 0.094 seconds and returned 60000 entries
Output for 5.1.3
Starting arraydiff arraydiff() took 0.120 seconds and returned 60000 entries
Output for 5.1.1
Starting arraydiff arraydiff() took 0.145 seconds and returned 60000 entries
Output for 5.1.0
Starting arraydiff arraydiff() took 0.104 seconds and returned 60000 entries
Output for 4.3.2, 4.3.5, 5.0.5
Starting arraydiff arraydiff() took 0.122 seconds and returned 60000 entries
Output for 5.0.4
Starting arraydiff arraydiff() took 0.144 seconds and returned 60000 entries
Output for 5.0.3
Starting arraydiff arraydiff() took 0.136 seconds and returned 60000 entries
Output for 5.0.2
Starting arraydiff arraydiff() took 0.137 seconds and returned 60000 entries
Output for 5.0.1
Starting arraydiff arraydiff() took 0.149 seconds and returned 60000 entries
Output for 4.4.9
Starting arraydiff arraydiff() took 0.152 seconds and returned 60000 entries
Output for 4.4.5, 4.4.7
Starting arraydiff arraydiff() took 0.129 seconds and returned 60000 entries
Output for 4.4.6
Starting arraydiff arraydiff() took 0.130 seconds and returned 60000 entries
Output for 4.3.9, 4.4.4
Starting arraydiff arraydiff() took 0.126 seconds and returned 60000 entries
Output for 4.3.1, 4.4.3
Starting arraydiff arraydiff() took 0.128 seconds and returned 60000 entries
Output for 4.4.1 - 4.4.2
Starting arraydiff arraydiff() took 0.127 seconds and returned 60000 entries
Output for 4.4.0
Starting arraydiff arraydiff() took -0.863 seconds and returned 60000 entries
Output for 4.3.10
Starting arraydiff arraydiff() took -0.868 seconds and returned 60000 entries
Output for 4.3.8
Starting arraydiff arraydiff() took 0.131 seconds and returned 60000 entries
Output for 4.3.7
Starting arraydiff arraydiff() took 0.121 seconds and returned 60000 entries
Output for 4.3.6
Starting arraydiff arraydiff() took 0.123 seconds and returned 60000 entries
Output for 4.3.4
Starting arraydiff arraydiff() took 0.139 seconds and returned 60000 entries
Output for 4.3.0
Starting arraydiff arraydiff() took 0.113 seconds and returned 60000 entries