[ create a new paste ] login | about

Link: http://codepad.org/1FywBmFV    [ raw code | output | fork ]

PHP, pasted on Sep 11:
1
2
3
4
5
6
7
8
9
10
11
<?php
$strs = Array("some", "thing", "here", "new");
$poss = Array(1, 2);
$new = Array();
for($i = 0; $i < pow(count($strs), count($poss)); $i++) {
  for($j = 0; $j < count($strs); $j++) {
    $new[$i] = $strs[($i%count($strs))] . " " . $strs[$j];
  }
}
print_r($new);
?>


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Array
(
    [0] => some new
    [1] => thing new
    [2] => here new
    [3] => new new
    [4] => some new
    [5] => thing new
    [6] => here new
    [7] => new new
    [8] => some new
    [9] => thing new
    [10] => here new
    [11] => new new
    [12] => some new
    [13] => thing new
    [14] => here new
    [15] => new new
)


Create a new paste based on this one


Comments: