bibilink,
Думаю и так сойдет)
<?php
$rands = [];
$view = NULL;
for($i = 5; $i > 0; $i--) {
$rand = mt_rand(1, 6);
$rands[] = $rand;
$view .= $rand .' ';
}
$count = array_count_values($rands);
$result = 0;
$results = [
1 => [1 => 10, 2 => 20, 3 => 100, 4 => 200, 5 => 1000 ],
2 => [1 => 0, 2 => 0, 3 => 20, 4 => 40, 5 => 200 ],
3 => [1 => 0, 2 => 0, 3 => 30, 4 => 60, 5 => 300 ],
4 => [1 => 0, 2 => 0, 3 => 40, 4 => 80, 5 => 400 ],
5 => [1 => 5, 2 => 10, 3 => 50, 4 => 100, 5 => 500 ],
6 => [1 => 0, 2 => 0, 3 => 60, 4 => 120, 5 => 600 ]
];
foreach($count AS $key => $value) $result = $result + $results[$key][$value];
echo $view .'('. $result .')';
?>
5 2 5 5 4 (50)
Gen:
start(1456982225.5)
end(1456982225.5)