Determines whether the php array is an indexed array implementation

  • 2020-06-15 07:53:27
  • OfStack

HP has no built-in method to determine whether an array is indexed or not. It simply implements 1 method.

echo is_assoc($array)?' The index array ':' Not an indexed array ';

The is_assoc function is as follows:

    function is_assoc($array) {
        if(is_array($array)) {
            $keys = array_keys($array);
            return $keys != array_keys($keys);
        return false;

Related articles: