3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $result = count(null); var_dump($result); $result = count("ffff"); var_dump($result); $result = count(123); var_dump($result); $result = count(true); var_dump($result); $result = count(false); var_dump($result); $result = count((object) []); var_dump($result); $result = count(['','']); var_dump($result);
based on hDnEJ
Output for 7.2.0 - 7.3.0rc3
Warning: count(): Parameter must be an array or an object that implements Countable in /in/m5Oqo on line 3 int(0) Warning: count(): Parameter must be an array or an object that implements Countable in /in/m5Oqo on line 5 int(1) Warning: count(): Parameter must be an array or an object that implements Countable in /in/m5Oqo on line 7 int(1) Warning: count(): Parameter must be an array or an object that implements Countable in /in/m5Oqo on line 9 int(1) Warning: count(): Parameter must be an array or an object that implements Countable in /in/m5Oqo on line 11 int(1) Warning: count(): Parameter must be an array or an object that implements Countable in /in/m5Oqo on line 13 int(1) int(2)
Output for 5.6.38 - 7.1.23
int(0) int(1) int(1) int(1) int(1) int(1) int(2)