function isIndexed($array)
{
if (is_array($array)) {
$keys = array_keys($array);
return $keys === array_keys($keys);
}
return false;
}
function isAssoc($array)
{
if (is_array($array)) {
$keys = array_keys($array);
return $keys !== array_keys($keys);
}
return false;
}
these two function is more faster than divinity76+spam at gmail dot com's about three times in my computer for PHP 8.2.9:
array(3) {
["pre"]=>
float(0.8179779052734375)
["post"]=>
float(0.8116860389709473)
["index"]=>
float(0.3369460105895996)
}
:)