We have two kinds of arrays in PHP:
$array["name"] = "George"
$array[0] = "George"
How can I determine (with a function returning true/false for example) which type of array I am working with?
There aren't two "kinds" of arrays, there is only one array type:
"There are no different indexed and associative array types in PHP; there is only one array type, which can both contain integer and string indices."
[ http://www.php.net/manual/en/language.types.array.php ]
So, you can have an array like this:
$array = array("hello", "name" => "Burhan");
If you just want to know if all keys are numeric, then you just do a check on the keys :
$keys = array_keys(array("hello","name" => "Burhan", "goodbye"));
foreach($keys as $key) { /* put your check in here */ }
Make sure you do a type-safe check ( === ) not ( == ) which is not type safe.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php