WordPress at a glance
function is not described

rest_sanitize_array() WP 5.5.0

Converts an array-like value to an array.

No Hooks.

Return

Array. Returns the array extracted from the value.

Usage

rest_sanitize_array( $maybe_array );
$maybe_array(mixed) (required)
The value being evaluated.

Changelog

Since 5.5.0 Introduced.

Code of rest_sanitize_array() WP 5.7.2

<?php
function rest_sanitize_array( $maybe_array ) {
	if ( is_scalar( $maybe_array ) ) {
		return wp_parse_list( $maybe_array );
	}

	if ( ! is_array( $maybe_array ) ) {
		return array();
	}

	// Normalize to numeric array so nothing unexpected is in the keys.
	return array_values( $maybe_array );
}