3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $test_uniqids = array( 'numeric' => "\x00"."5425368523947", 'non-numeric' => "\x00"."54253685ed947", 'numeric-append' => "\x00"."5425368523947x" ); foreach ($test_uniqids as $test => $uniqid) { print $test."\t"; print is_numeric($uniqid) ? 'is_numeric' : 'no_numeric'; print "\t"; var_dump($uniqid); $vals = array(); $vals[$uniqid] = TRUE; foreach ($vals as $key => $val) { var_dump($key); if ($key === $uniqid) { print "matches\n"; } else { print "does not match\n"; } } }
based on Zkr07
Output for 4.3.3 - 7.1.0
numeric no_numeric string(14) "5425368523947" string(14) "5425368523947" matches non-numeric no_numeric string(14) "54253685ed947" string(14) "54253685ed947" matches numeric-append no_numeric string(15) "5425368523947x" string(15) "5425368523947x" matches
Output for 4.3.0 - 4.3.2
numeric no_numeric string(14) "5425368523947" string(0) "" does not match non-numeric no_numeric string(14) "54253685ed947" string(0) "" does not match numeric-append no_numeric string(15) "5425368523947x" string(0) "" does not match