3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function test($array) { try { return isDictionary($array); } catch (Exception $e) { echo $e->getMessage(); return 'error'; } } function isDictionary($array) { return !(bool)count(array_filter(array_keys($array), 'is_string')); } $arr = 0; var_dump(test($arr));
based on hWHq8
Output for 7.2.0
Warning: array_keys() expects parameter 1 to be array, integer given in /in/tOFqo on line 17 Warning: array_filter() expects parameter 1 to be array, null given in /in/tOFqo on line 17 Warning: count(): Parameter must be an array or an object that implements Countable in /in/tOFqo on line 17 bool(true)
Output for 5.3.19 - 7.1.10
Warning: array_keys() expects parameter 1 to be array, integer given in /in/tOFqo on line 17 Warning: array_filter() expects parameter 1 to be array, null given in /in/tOFqo on line 17 bool(true)