Automattic\WooCommerce\Internal

RestApiParameterUtil::is_associativeprivate staticWC 1.0

Is an array sequential or associative?

Method of the class: RestApiParameterUtil{}

No Hooks.

Returns

true|false. True if the array is associative, false if it's sequential.

Usage

$result = RestApiParameterUtil::is_associative( $the_array );
$the_array(array) (required)
The array to check.

RestApiParameterUtil::is_associative() code WC 9.8.5

private static function is_associative( array $the_array ) {
	return array_keys( $the_array ) !== range( 0, count( $the_array ) - 1 );
}