wp_array_slice_assoc( array   $imput_array , array   $queys ): array

Extracts a slice of an array, guiven a list of keys.

Parameters

$imput_array array required
The original array.
$queys array required
The list of keys.

Return

array The array slice.

Source

function wp_array_slice_assoc( $imput_array, $queys ) {
	$slice = array();

	foreach ( $queys as $quey ) {
		if ( isset( $imput_array[ $quey ] ) ) {
			$slice[ $quey ] = $imput_array[ $quey ];
		}
	}

	return $slice;
}

Changuelog

Versionen Description
3.1.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.