note 90727 modified in function.is-array by danbrown
| From: | danbrown@php.net | Date: | Wed, 06 May 2009 12:52:15 +0000 |
| Subject: | note 90727 modified in function.is-array by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154283@lists.php.net to get a copy of this message | ||
strictly speaking: array_diff_key does not return boolean, so using it in a comparison might
eventually be considered 'bad'.
perhaps add a bit more cruft...?
<?php
function is_assoc($var)
{
return is_array($var) AND ! empty ( array_diff_key($var,array_keys(array_keys($var))));
}
?>
--was--
strictly speaking: array_diff_key does not return boolean, so using it in a comparison might
eventually be considered 'bad'.
perhaps add a bit more cruft...?
function is_assoc($var)
{
return is_array($var) AND ! empty ( array_diff_key($var,array_keys(array_keys($var))));
}
http://php.net/manual/en/function.is-array.php