3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function runTest($v) { echo "Test case for "; var_dump($v); var_dump(is_numeric($v)); echo "\n\n"; } runTest('3'); runTest(3); runTest('1'); runTest(1); runTest('0'); runTest(0); runTest('-1'); runTest(-1); runTest(null); runTest(''); runTest(false);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Test case for string(1) "3" bool(true) Test case for int(3) bool(true) Test case for string(1) "1" bool(true) Test case for int(1) bool(true) Test case for string(1) "0" bool(true) Test case for int(0) bool(true) Test case for string(2) "-1" bool(true) Test case for int(-1) bool(true) Test case for NULL bool(false) Test case for string(0) "" bool(false) Test case for bool(false) bool(false)