WordPress at Your Fingertips

wp_is_numeric_array() WP 1.0

Determines if the variable is a numeric-indexed array.

1 time — 0.000016 sec (very fast) | 50000 times — 0.03 sec (speed of light) | PHP 7.0.4, WP 4.4.2

No Hooks.

Return

true|false. Whether the variable is a list.

Usage

wp_is_numeric_array( $data );
$data(mixed) (required)
Variable to check.

Changelog

Since 4.4.0 Introduced.

Code of wp_is_numeric_array() WP 5.8.1

function wp_is_numeric_array( $data ) {
	if ( ! is_array( $data ) ) {
		return false;
	}

	$keys        = array_keys( $data );
	$string_keys = array_filter( $keys, 'is_string' );

	return count( $string_keys ) === 0;
}

array list help functions (sorting arrays objects)

No comments
    Log In