Brimbox Logo Brimbox Version 2.3.4 Released

filter_keys>>

Method to filter an array by keys. both by key type (integer or string) and by keys specified in an filter array.

Class: bb_meta, called as $main

File: bb_meta.php (php)

Declaration:

function filter_keys($arr, $filter = array(), $keep_mode = true, $key_type = false)

Usage:

$main->filter_keys($arr, $filter, $keep_mode, $key_type);

Returns: generic filtered array.

Note: by default filter_keys strips off string keys.

Parameter: $arr (array)
Array to be filtered.

Parameter: $filter (string)
An array of keys to either keep or discard. An empty array, or default, will bypass this functionality and keep all keys.

Parameter: $keep_mode (string)
If true will keep all keys in the $filter, if false will discard all keys in $filter, if $filter is empty, does nothing.

Parameter: $key_type (boolean)
Reduces array keys by integer (false), string (true) or neither (NULL)

Updated: 2016-07-11