HP does not have a built-in method to determine whether to index an array. It simply implements one. Usage:
Copy code The code is as follows:
echo is_assoc($array)?'Index array':'Not an index array';
The is_assoc function is as follows:
Copy code The code is as follows:
function is_assoc($array) {
if(is_array($array)) {
$keys = array_keys($array);
return $keys! = array_keys($keys);
}
return false;
http://www.bkjia.com/PHPjc/327562.html
www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327562.htmlTechArticleHP does not have a built-in method to determine whether to index an array. We simply implemented one. Usage: Copy the code. The code is as follows: echo is_assoc ($array)?'Index array':'Not an index array'; is_assoc function...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn