[ create a new paste ] login | about

Link: http://codepad.org/vfj9hXIu    [ 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, 3);
$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:
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
    [16] => some new
    [17] => thing new
    [18] => here new
    [19] => new new
    [20] => some new
    [21] => thing new
    [22] => here new
    [23] => new new
    [24] => some new
    [25] => thing new
    [26] => here new
    [27] => new new
    [28] => some new
    [29] => thing new
    [30] => here new
    [31] => new new
    [32] => some new
    [33] => thing new
    [34] => here new
    [35] => new new
    [36] => some new
    [37] => thing new
    [38] => here new
    [39] => new new
    [40] => some new
    [41] => thing new
    [42] => here new
    [43] => new new
    [44] => some new
    [45] => thing new
    [46] => here new
    [47] => new new
    [48] => some new
    [49] => thing new
    [50] => here new
    [51] => new new
    [52] => some new
    [53] => thing new
    [54] => here new
    [55] => new new
    [56] => some new
    [57] => thing new
    [58] => here new
    [59] => new new
    [60] => some new
    [61] => thing new
    [62] => here new
    [63] => new new
)


Create a new paste based on this one


Comments: