Advertisement
Guest User

Untitled

a guest
Feb 25th, 2013
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.28 KB | None | 0 0
  1.         $v1 = 1;
  2.         ksort($this->_vendors);
  3.         $combinations = array();
  4.  
  5.         foreach ($this->_vendors as $val) {
  6.  
  7.             for ($v2 = $v1; $v2 < sizeof($this->_vendors); $v2++) {
  8.  
  9.                 if (isset($this->_vendors[$v2 + 1])) {
  10.  
  11.                     $this->_updateCombinations(
  12.                         array($v1, $v2 + 1),
  13.                         $val,
  14.                         $combinations
  15.                     );
  16.                 }
  17.  
  18.                 if (sizeof($this->_vendors) > 3) {
  19.  
  20.                     for ($v3 = $v2; $v3 < sizeof($this->_vendors); $v3++) {
  21.  
  22.                         if (isset($this->_vendors[$v3 + 2])) {
  23.  
  24.                             $this->_updateCombinations(
  25.                                 array($v1, $v2 + 1, $v3 + 2),
  26.                                 $val,
  27.                                 $combinations
  28.                             );
  29.                         }
  30.  
  31.                         if (sizeof($this->_vendors) > 4) {
  32.  
  33.                             for ($v4 = $v3; $v4 < sizeof($this->_vendors); $v4++) {
  34.  
  35.                                 if (isset($this->_vendors[$v4 + 3])) {
  36.  
  37.                                     $this->_updateCombinations(
  38.                                         array($v1, $v2 + 1, $v3 + 2, $v4 + 3),
  39.                                         $val,
  40.                                         $combinations
  41.                                     );
  42.                                 }
  43.  
  44.                                 if (sizeof($this->_vendors) > 5) {
  45.  
  46.                                     for ($v5 = $v4; $v5 < sizeof($this->_vendors); $v5++) {
  47.  
  48.                                         if (isset($this->_vendors[$v5 + 3])) {
  49.  
  50.                                             $this->_updateCombinations(
  51.                                                 array($v1, $v2 + 1, $v3 + 2, $v4 + 3, $v5 + 3),
  52.                                                 $val,
  53.                                                 $combinations
  54.                                             );
  55.                                         }
  56.                                     }
  57.                                 }
  58.                             }
  59.                         }
  60.                     }
  61.                 }
  62.             }
  63.             $v1++;
  64.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement