3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $numeric_fails = 0; $non_numeric_fails = 0; $iterations = 1000; for ($i = 0; $i < $iterations; $i++) { $my_key = uniqid("\x00"); $var = array(); $var[$my_key] = TRUE; foreach ($var as $key => $val) { if ($key === $my_key) { } else { if (is_numeric($my_key)) { $numeric_fails++; } else { $non_numeric_fails++; } } } } print "Had failures with non-numeric keys: ".($non_numeric_fails ? 'Yes' : 'No')."\n"; print "Had failures with numeric keys: ".($numeric_fails ? 'Yes' : 'No')."\n";
based on RGnSt
Output for 4.3.0 - 4.3.2, 4.3.9 - 5.3.9, 5.3.16 - 5.3.17, 5.3.23 - 5.3.24, 5.3.29, 5.4.4, 5.4.10 - 5.4.11, 5.4.16, 5.4.21 - 5.4.22, 5.4.26, 5.4.31 - 5.5.35, 5.6.8 - 7.0.5, 7.0.14 - 7.1.0
Had failures with non-numeric keys: No Had failures with numeric keys: No
Output for 4.3.3 - 4.3.8, 5.3.10 - 5.3.15, 5.3.18 - 5.3.22, 5.3.25 - 5.3.28, 5.4.0 - 5.4.3, 5.4.5 - 5.4.9, 5.4.12 - 5.4.15, 5.4.17 - 5.4.20, 5.4.23 - 5.4.25, 5.4.27 - 5.4.30, 5.6.7, 7.0.6
Had failures with non-numeric keys: No Had failures with numeric keys: Yes