public static function LingotekSync::arraySumValues in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::arraySumValues()
- 7.5 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::arraySumValues()
Sums the values of the arrays be there keys (PHP 4, PHP 5) array array_sum_values ( array array1 [, array array2 [, array ...]] )
1 call to LingotekSync::arraySumValues()
- lingotek_get_language_details in ./
lingotek.dashboard.inc - Get the details of each language
File
- lib/
Drupal/ lingotek/ LingotekSync.php, line 233 - LingotekSync
Class
- LingotekSync
- A utility class for Lingotek Syncing.
Code
public static function arraySumValues() {
$return = array();
$intArgs = func_num_args();
$arrArgs = func_get_args();
if ($intArgs < 1) {
trigger_error('Warning: Wrong parameter count for arraySumValues()', E_USER_WARNING);
}
foreach ($arrArgs as $arrItem) {
if (!is_array($arrItem)) {
trigger_error('Warning: Wrong parameter values for arraySumValues()', E_USER_WARNING);
}
foreach ($arrItem as $k => $v) {
if (!key_exists($k, $return)) {
$return[$k] = 0;
}
$return[$k] += $v;
}
}
return $return;
$sumArray = array();
foreach ($myArray as $k => $subArray) {
foreach ($subArray as $id => $value) {
$sumArray[$id] += $value;
}
}
return $sumArray;
}