wp_is_numeric_array

函数
wp_is_numeric_array ( $data )
参数
  • (mixed) $data Variable to check.
    Required:
返回值
  • (bool) Whether the variable is a list.
定义位置
相关方法
wp_kses_array_lcwp_is_json_media_typewp_insert_category_set_cron_arraywp_kses_one_attr
引入
4.4.0
弃用
-

Determines if the variable is a numeric-indexed array.

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;
}