3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // string, null, bool, float, largest specified previous index function isIndexedArray($array) { return !(bool)count(array_filter(array_keys($array), 'is_string')); } assert(isIndexedArray(NULL)); assert(isIndexedArray(['a']));
based on 1R9SG
Output for 7.2.0
Warning: array_keys() expects parameter 1 to be array, null given in /in/7RJNn on line 5 Warning: array_filter() expects parameter 1 to be array, null given in /in/7RJNn on line 5 Warning: count(): Parameter must be an array or an object that implements Countable in /in/7RJNn on line 5
Output for 5.4.9 - 7.1.10
Warning: array_keys() expects parameter 1 to be array, null given in /in/7RJNn on line 5 Warning: array_filter() expects parameter 1 to be array, null given in /in/7RJNn on line 5
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/7RJNn on line 9
Process exited with code 255.