wp_array_slice_assoc( array $array, array $keys )

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


Parameters

$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
WP-3.1.0 Introduced.