public static function ShareaholicUtilities::associative_array_slice in Share Buttons, Related Posts, Content Analytics - Shareaholic 7.3
Same name and namespace in other branches
- 8 utilities.php \ShareaholicUtilities::associative_array_slice()
Give back only the request keys from an array. The first argument is the array to be sliced, and after that it can either be a variable-length list of keys or one array of keys.
Parameters
array $array:
Mixed ... can be either one array or many keys:
Return value
array
1 call to ShareaholicUtilities::associative_array_slice()
- ShareaholicUtilities::set_default_location_settings in ./
utilities.php - Given an object, set the default on/off locations for share buttons and recommendations
File
- ./
utilities.php, line 581
Class
Code
public static function associative_array_slice($array) {
$keys = array_slice(func_get_args(), 1);
if (func_num_args() == 2 && is_array($keys[0])) {
$keys = $keys[0];
}
$result = array();
foreach ($keys as $key) {
$result[$key] = $array[$key];
}
return $result;
}