wp_array_slice_assoc( array $input_array, array $keys )

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


Parameters

$input_array

(Required) The original array.

$keys

(Required) The list of keys.


Return

(array) The array slice.


Source

File: wp-includes/functions.php

function wp_array_slice_assoc( $array, $keys ) {
	$slice = array();
	foreach ( $keys as $key )
		if ( isset( $array[ $key ] ) )
			$slice[ $key ] = $array[ $key ];

	return $slice;
}

Changelog

Changelog
Version Description
3.1.0 Introduced.