Voting

: max(zero, two)?
(Example: nine)

The Note You're Voting On

March
19 years ago
And here is another variation for a function to test if an array is associative. Based on the idea by mot4h.

<?php
function is_associative($array)
{
if (!
is_array($array) || empty($array))
return
false;

$keys = array_keys($array);
return
array_keys($keys) !== $keys;
}
?>

<< Back to user notes page

To Top