3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php var_dump(count(null)); var_dump(count(0)); class Foo implements Countable { public function count() { return 4; } } $foo = new Foo; var_dump(!is_array($foo) && 4 == count($foo));
Output for 5.1.0 - 7.1.0
int(0) int(1) bool(true)
Output for 5.0.5
int(0) int(1) Fatal error: Interface 'Countable' not found in /in/vs45L on line 6
Process exited with code 255.
Output for 5.0.0 - 5.0.4
int(0) int(1) Fatal error: Class 'Countable' not found in /in/vs45L on line 6
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting '{' in /in/vs45L on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting '{' in /in/vs45L on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'{'' in /in/vs45L on line 6
Process exited with code 255.