Date: 03/23/07 (PHP Community) Keywords: no keywords I have an array of sizes:
if (!isset($_COOKIE['magi']['size'])) echo $warning; else $dims = explode("x", $_COOKIE['magi']['size']);
if (!in_array($_COOKIE['magi']['size'], $standardSizes)) {
foreach($standardSizes as $size) {
$size = explode("x", $size);
if ($dims[0] <= $size[0]) $compWidth = $size[0];
if ($dims[1] <= $size[1]) $compHeight = $size[1];
}
} else {
$compWidth = $dims[0];
$compHeight = $dims[1];
}
echo $compWidth ." x ". $compHeight;
($dims[0] = custom width, $dims[1] = custom height .. $compWidth needs to be the closest standard width, $compHeight the closest standard height) However, this (logically) only gives me the size of the biggest board. Any ideas how I should approach this? I'm stuck. Edit: Solved by shippo, thank you :)
|