All pastes #624537 Raw Edit

Mine

public text v1 · immutable
·published 2007-07-18 10:56 UTC
rendered paste body
function all_building_cumulate ($user_building) {

	$total = 0;

	while($data = current($user_building)) {
	
		$bats = array_keys($data);
		$tot = 0;
		foreach($bats as $key) {
			$Ti = 0;
			$Ca = 0;
			$Tr = 0;
			
			$level = $data[$key];
			if($level=="") $level = 0;
			echo $key." : ".$level."<br/>";
			if($key == "Ti" || $key == "Ca" || $key == "Tr" || $key == "CG" || $key == "CaT" || $key == "UdD" || $key == "UdA" || 
			$key == "UA" || $key == "STi" || $key == "SCa" || $key == "STr" || $key == "CT" || $key == "Ter" || 
			$key == "HM" || $key == "CM" || $key == "Sat") {
				
				if($level > 0) list($Ti, $Ca, $Tr) = array_values(building_cumulate($key, $level));
				$tot += $Ti + $Ca + $Tr;
				$total += $Ti + $Ca + $Tr;
				echo number_format($Ti+$Ca+$Tr,2,","," ")."<br/>";
			}
			
		}
		echo number_format($tot,2,","," ");
		echo "<br/><br/>";
		next($user_building);
	}

	return $total;
}