欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

第一次又没有了! 唉!

程序员文章站 2022-04-15 10:11:10
...
 $value) {
				$rtuvalue[] = $args_num[$key];
			}
			break;
		default:
			if (!empty($args) && $args>=2) {
				for ($i=0; $i < $args; $i++) { 
					if(is_array(func_get_arg($i))){
						$tmparr = array();
						$tmparr = func_get_arg($i);
						foreach ($tmparr as $key => $value) {
							$rtuvalue[] = $tmparr[$key];
						}
					}
				}
			}
			break;
	}
	if (is_array($rtuvalue)) {
		$rtuvalues = sortarray($rtuvalue);
		return $rtuvalues;
	}else{
		echo '参数不正确!';
	}
}

function sortarray($arr){
	$tmpval;
	for($i=0;$i<(count($arr)-1);$i++){
		for($j=0;$j $arr[$j+1]){
				$tmpval = $arr[$j];
				$arr[$j] = $arr[$j+1];
				$arr[$j+1] = $tmpval;
			}

		}
	}
	return $arr;
}

function statistics_num($arr){
	$temp_arr;
	if(!is_array($arr)) return false;
	$count = count($arr);
	for($i=0;$i<$count;$i++){
		$$arr[$i] = 1;
		for ($j=0; $j < $count; $j++) { 
			if ($arr[$i] == $arr[$j]) {
				$temp_arr[$arr[$i]] = $$arr[$j]++;
			}
		}
	}
	return $temp_arr;
}

$array1 = array('11','2','2','14','3','4','4','11','5','3','12','61','51');
$array2 = array('12','41','72','44','31','31','12','19','13','222','16','6','51');
$array3 = array('12','42','17','24','31','13','122','59','13','22','16','6','5');
$array4 = array('13','43','27','43','32','32','12','9','13','22','16','6','5');
$array5 = array('14','44','37','24','13','131','132','59','13','22','16','6','5');
$array6 = array('15','54','47','43','32','32','142','9','13','22','16','6','5');
$array7 = array('16','64','57','42','33','32','12','69','13','22','16','6','5');
$array8 = array('17','47','67','74','13','13','12','9','13','22','16','6','5');
$arrs = merge_array_values($array1,$array2,$array3,$array4,$array5,$array6,$array7,$array8);
print_r(statistics_num($arrs));