Posted by Hero Wanders on 09/16/05 17:07
Hello!
> function array_is_simple(&$arr) {
> if(!is_array($arr))
> return false;
>
> $keys = array_keys($arr);
> foreach($keys as $x)
> if(!is_numeric($x) || intval($x) != $x)
> return false;
>
> return true;
> }
I would prefer this:
function array_is_simple(&$arr)
{
return $arr == array_values($arr);
}
Greetings,
Hero Wanders
[Back to original message]
|