Skip to content

Commit

Permalink
Update PhpCollection.php
Browse files Browse the repository at this point in the history
  • Loading branch information
izica authored Oct 27, 2019
1 parent f726517 commit cd0e77c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions PhpCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ public function unique()
public function sum($keyOrFunc = null)
{
$nResult = 0;
if ($sKey === null) {
if ($keyOrFunc === null) {
foreach ($this->arCollection as $nItem) {
$nResult += $nItem;
}
Expand All @@ -512,7 +512,7 @@ public function sum($keyOrFunc = null)
}
} else {
foreach ($this->arCollection as $arItem) {
$nResult += $arItem[$sKey];
$nResult += $arItem[$keyOrFunc];
}
}
}
Expand Down

0 comments on commit cd0e77c

Please sign in to comment.