I am not sure how to set up an array to work with my current script. Is there another way we can do this without using an array? My son wrote most of the code below and is now moved out and I cannot really communicate with him now. I am really in a pinch to get this code finished - I need help in a desperate way!
I have a php script that is over 600 lines long. I declare the variable $test in 4 different IF statements below:
$exclude_gnd=0;
$exclude_1da=0;
$exclude_2da=1;
$exclude_3da=0;
/* a little bit of searching through the name
to find out what kind of shipping to use */
if(strpos($methodName, 'ground') !== false and $exclude_gnd!==1){
if ($exclude_gnd==1){$test=1;}
if($groundZone != '-'){
$baseShippingCost = us_get_cost_for_lbs_and_zone('ups_commus48_gnd', $evalWeight, $groundZone);
$shipDiscount = $shippingDiscounts['ground'];
}
/*elseif($groundZone = '-'){$baseShippingCost = 0;}*/
}
else{$baseShippingCost = 0; }
//else{$baseShippingCost = 0; }
if((strpos($methodName, 'overnight') !== false or strpos($methodName, "next day") !== false) and $exclude_1da!==1){
if ($exclude_1da==1){$test=1;}
if($overNightZone != '-'){
$baseShippingCost = us_get_cost_for_lbs_and_zone('ups_commus48_1da', $evalWeight, $overNightZone);
$shipDiscount = $shippingDiscounts['overnight'];
}
/*elseif($overNightZone = '-'){$baseShippingCost = 0;}*/
else{$baseShippingCost = 0; }
}
//else{$baseShippingCost = 0; }
if(strpos($methodName, '2nd') !== false and $exclude_2da!==1){
if ($exclude_2da==1){$test=1;}
if($twoDayZone != '-')
{
$baseShippingCost = us_get_cost_for_lbs_and_zone('ups_commus48_2da', $evalWeight, $twoDayZone);
$shipDiscount = $shippingDiscounts['second'];
}
/*elseif($twoDayZone = '-'){$baseShippingCost = 0;}*/
else {$baseShippingCost = 0;}
}
//else {$baseShippingCost = 0;}
if(strpos($methodName, '3 day') !== false and $exclude_3da!==1){
if ($exclude_3da==1){$test=1;}
if($threeDayZone != '-'){
$baseShippingCost = us_get_cost_for_lbs_and_zone('ups_commus48_3ds', $evalWeight, $threeDayZone);
$shipDiscount = $shippingDiscounts['third'];
}
/*elseif($threeDayZone = '-'){$baseShippingCost = 0;}*/
else{$baseShippingCost = 0; }
}
//else{$baseShippingCost = 0; }
/*else{
$baseShippingCost = $groundCost;
}*/
$tempArr = array($baseShippingCost, $methodName, $shipDiscount);
return $tempArr;
}
and then later on in the php page I try to retrieve the $test variable for use in this script:
$endTotalShippingCost = $dryIceCost + $totBoxCost + $shippingCost;
Can you please look at my code and tell me if it looks correct or if I can change it in some way and also if how I can call the $test variable later on in the php script (I need to call it when I get to the "$endTotalShippingCost = $dryIceCost + $totBoxCost + $shippingCost;" portion of the page.
Thank you for all of your help!