Browse Source

Fix logical operators

Alexandros Solanos 9 years ago
parent
commit
22b72f03a2
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/Collection/CollectionTrait.php

+ 3 - 3
src/Collection/CollectionTrait.php

@@ -702,18 +702,18 @@ trait CollectionTrait
         $currentIndexes = array_fill(0, $lastIndex + 1, 0);
         $changeIndex = $lastIndex;
 
-        while (!($changeIndex === 0 AND $currentIndexes[0] === $counts[0])) {
+        while (!($changeIndex === 0 && $currentIndexes[0] === $counts[0])) {
             $currentCombination = array_map(function ($arr, $index) {
                 return $arr[$index];
             }, $allArr, $currentIndexes);
 
-            if ($filter === null OR $filter(...$currentCombination)) {
+            if ($filter === null || $filter(...$currentCombination)) {
                 $result[] = ($operation === null) ? $currentCombination : $operation(...$currentCombination);
             }
 
             $currentIndexes[$lastIndex]++;
 
-            for ($changeIndex = $lastIndex; $currentIndexes[$changeIndex] === $counts[$changeIndex] AND $changeIndex > 0; $changeIndex--) {
+            for ($changeIndex = $lastIndex; $currentIndexes[$changeIndex] === $counts[$changeIndex] && $changeIndex > 0; $changeIndex--) {
                 $currentIndexes[$changeIndex] = 0;
                 $currentIndexes[$changeIndex - 1]++;
             }