Home > Backend Development > PHP Tutorial > How to determine whether a php array is an index array_PHP tutorial

How to determine whether a php array is an index array_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:06:59
Original
1124 people have browsed it

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

truehttp: //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...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template