wp_array_slice_assoc() – Extracts a slice of an array, given a list of keys.

You appear to be a bot. Output may be restricted

Description

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

Usage

$array = wp_array_slice_assoc( $input_array, $keys );

Parameters

$input_array
( array ) required – The original array.
$keys
( array ) required – The list of keys.

Returns

array The array slice.

Source

File name: wordpress/wp-includes/functions.php


Lines:

1 to 12 of 12
function wp_array_slice_assoc( $input_array, $keys ) {
  $slice = array();

  foreach ( $keys as $key ) {
    if ( isset( $input_array[ $key ] ) ) {
      $slice[ $key ] = $input_array[ $key ];
    }
  }

  return $slice;
}
 

 View on GitHub View on Trac