3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php var_dump(preg_match('/^-?\d+$/', new \stdClass())); var_dump(preg_match('/^-?\d+$/', '123')); var_dump(ctype_digit(0)); var_dump(ctype_digit("0")); var_dump(ctype_digit("1"));
Output for 5.3.0 - 5.6.25, 7.0.0 - 7.1.0
Warning: preg_match() expects parameter 2 to be string, object given in /in/W4FI6 on line 2 bool(false) int(1) bool(false) bool(true) bool(true)
Output for hhvm-3.10.0 - 3.12.0
Warning: preg_match() expects parameter 2 to be string, object given in /in/W4FI6 on line 2 NULL int(1) bool(false) bool(true) bool(true)
Output for 4.3.3 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/W4FI6 on line 2 Warning: preg_match() expects parameter 2 to be string, object given in /in/W4FI6 on line 2 bool(false) int(1) bool(false) bool(true) bool(true)
Output for 4.3.0 - 4.3.2
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/W4FI6 on line 2 Notice: Object to string conversion in /in/W4FI6 on line 2 int(0) int(1) bool(false) bool(true) bool(true)