Brimbox Logo Brimbox Version 2.3.4 Released


Function to quickly reduce an array by its keys and extract string or integer keys from the reduced array.

Class: bb_meta, called as $main

File: bb_meta.php (php)


function reduce($arr, $keys = NULL, $key_type = NULL)


$main->reduce($arr, $keys, $key_type)

Returns: array reduced by keys and key types.

Parameter: $arr (array)
PHP array, usually with multiple nesting.

Parameter: $keys (string or array)
The key to reduce by, for instance $arr = $arr[$keys] or $arr = $arr[$keys[0]][$keys[1]]

Parameter: $key_type (string)
Whether to reduce array keys by integer (false), string (true) or neither (NULL)

Updated: 2016-07-11