So what do the values correspond to? What is "USPS Ground 6, 10, 14, ..." referring to? Number of miles, amount? Assuming you are doing something like this:
Shipment Method | 1 - 50 | 51 - 100 | 101 - 150 | etc....
USPS Ground | 6 | 10 | 14
Second Day | 9 | 14 | 18
Next Day | 12 | 20 | 28
Then this is probably how you should structure your arrays:
<?php
$multiarray = array("USPS Ground" => array('6', '10', '14', '17', '19', '21', '23', '27'),
"Second Day" => array('9', '14', '18', '21', '23', '25', '27', '31'),
"Next Day" => array('12', '20', '28', '34', '38', '42', '46', '54'));
Then, once you've done that, and they're sending the "shipping method" via a POST variable (I assume) you can do the following:
$meth = $_POST['method'];
$tot = ; // Do whatever totaling stuff you need here
function get_rate($tot)
{
switch($tot)
{
case $tot>=1 && $tot<=50:
$rate = 0;
break;
case $tot>=51 && $tot<=100:
$rate = 1;
break;
case $tot>=101 && $tot<=151;
$rate = 2;
break;
case $tot>=151 && $tot<=200;
$rate = 2;
break;
case $tot>=201 && $tot<=250:
$rate = 3;
break;
case $tot>=251 && $tot<=300:
$rate = 4;
break;
case $tot>=301 && $tot<=350:
$rate = 5;
break;
case $tot>=351 && $tot<=400:
$rate = 6;
break;
case $tot>=401 && $tot<=450:
$rate = 7;
break;
}
return $rate;
}
$shipping = $multiarray[$meth][get_rate($tot)];
?>
I hope that helps. For a working example, here is what I used to test:
<?php
$multiarray = array("USPS Ground" => array('6', '10', '14', '17', '19', '21', '23', '27'),
"Second Day" => array('9', '14', '18', '21', '23', '25', '27', '31'),
"Next Day" => array('12', '20', '28', '34', '38', '42', '46', '54'));
function get_rate($tot)
{
switch($tot)
{
case $tot>=1 && $tot<=50:
$rate = 0;
break;
case $tot>=51 && $tot<=100:
$rate = 1;
break;
case $tot>=101 && $tot<=151;
$rate = 2;
break;
case $tot>=151 && $tot<=200;
$rate = 2;
break;
case $tot>=201 && $tot<=250:
$rate = 3;
break;
case $tot>=251 && $tot<=300:
$rate = 4;
break;
case $tot>=301 && $tot<=350:
$rate = 5;
break;
case $tot>=351 && $tot<=400:
$rate = 6;
break;
case $tot>=401 && $tot<=450:
$rate = 7;
break;
}
return $rate;
}
$tot = '75';
$method = 'Second Day';
echo 'Rate for $'.$tot.'.00 is:<br>
USPS Ground: $'.$multiarray['USPS Ground'][get_rate($tot)].'<br>
Second Day: $'.$multiarray['Second Day'][get_rate($tot)].'<br>
Next Day: $'.$multiarray['Next Day'][get_rate($tot)];
?>
I hope this helps you.
~Brett