Home >php教程 >PHP源码 >彩票排列三组选三算法

彩票排列三组选三算法

PHP中文网
PHP中文网Original
2016-05-25 16:59:441238browse

跳至

function arrange($arr){
	$new_arr = array();
	$c = count($arr);
	foreach($arr as $key=>$vo){
		$lin = $arr;
		array_splice($lin,$key,1);
		  for($l=0;$l<$c-1;$l++){
			$larr = array();
			$larr[] = $lin[$l];
			$larr[] = $vo;
			$larr[] = $vo;
			$new_arr[] = $larr;
		  }
	}
	return $new_arr;
}
$arr = array(1,2,3,4);
$r = arrange($arr);

                   

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn