lp__array_is_assoc( $array )

An array helper function that checks if an array is associative (i.e. has string keys or non-sequential integer keys).

Plugin

Namespace

Launchpad

Parameters

array

$array

The array to check.

Return

bool

True if the input array is associative, false otherwise.

Source

File: \includes\lp-utility-functions.php

function lp__array_is_assoc( $array ) {
    $assoc = false;
    if( is_array( $array ) && ! empty( $array ) ){
        if( array_keys($array) !== range(0, count($array) - 1) ) $assoc = true;
    }
    return $assoc;
}

Related

Used to check if a given string is a serialized value.

Used to insert a value or an array into an array before or after a specified identifier.

Used to retrieve the value from an array based on a given key.

Used to retrieve the value from an array based on a given key.