I need check if a specific Array is keyed or indexed. For instance:
// Key defined array
array('data-test' => true, 'data-object' => false);
// Indexed array
array('hello', 'world');
I can easily do a foreach
with the array keys to check if all is integer. But exists a correct way to check it? A built-in PHP function?
POSSIBLE SOLUTION
// function is_array_index($array_test);
// $array_test = array('data-test' => true, 'data-object' => false);
foreach(array_keys($array_test) as $array_key) {
if(!is_numeric($array_key)) {
return false;
}
}
return true;