3v4l.org

run code in 200+ 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 - 7.2.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 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)