[ create a new paste ] login | about

Link: http://codepad.org/YA5fX8aC    [ raw code | output | fork ]

PHP, pasted on Aug 3:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
$xArray = $yArray = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
$resultArray = array();
foreach($xArray as $x) {
	foreach($yArray as $y) {
		$result = $x + $y;
		$resultArray[$result] = $resultArray[$result] + 1;
	}
}
foreach ($resultArray as $key => $val) {
    if ($val == max($resultArray))
		echo $key;
}
?>


Output:
1
10


Create a new paste based on this one


Comments: