Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $n=8;//длина
- $m=2;
- $a=new SplFixedArray($n);
- $out=array();
- rec(0);
- print_r($out);
- function out(){
- global $a,$n,$out;
- $tmp='';
- for($i=0;$i<$n;++$i){
- $tmp.=$a[$i];
- }
- $out[]=$tmp;
- }
- function rec($inx){
- global $a,$m,$n;
- if($inx==$n){
- out();
- return;
- }
- for($i=1;$i<=$m;++$i){
- $a[$inx]=$i;
- rec($inx+1);
- }
- }
Add Comment
Please, Sign In to add comment