Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6188491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:14:27+00:00 2026-05-24T02:14:27+00:00

Im building a shipping calculator for fedex which is working fine when i need

  • 0

Im building a shipping calculator for fedex which is working fine when i need to ship one item, but sometimes i need to ship multiple items.
code:

$xyz=calcShip(30,4,4,2.5);
foreach ($xyz as $sType => $tCost){
    print $sType ." ". $tCost . "<br>";
}

the print looks like this:

Priority Overnight 32.49
Standard Overnight 60.38
2 Day 28.58
Express Saver 22.08
Ground 8.35

but if i want to calculate multiple shipments one after another and the shipment types are always those 5 in the same order, how can i just add all of the prices together for each type?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:14:27+00:00Added an answer on May 24, 2026 at 2:14 am
    $total = array();
    $shipping_parameters = array(
        // each shipping calculation would be added as an array here eg.
        array(30,4,4,2.5),
        array(29,3,3,3),
    );
    
    foreach($shipping_parameters as $shipping_param) {
        $xyz = call_user_func_array('calcShip', $shipping_param);
        foreach ($xyz as $sType => $tCost){
            if(!isset($total[$sType])) {
                $total[$sType] = 0;
            }
            $total[$sType] += $tCost;
        }
    }
    
    print_r($total);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building shopping mall website using Yahoo solution. My products have multiple options which
I'm working on a WinForms C# 3.0 / .NET 3.5 project involving building some
I'm looking into building a web app that allows multiple e-commerce stores to coexist
I'm building a shopping cart with session state. But i've a problem that when
I am currently building an ecommerce site with PHP/MySQL. Recently, I have been working
Building a test web service and all was working great, so I added the
While building an ecommerce platform I have run into design problems. I'm working with
I am working on building an embedded network appliance (linux based) and have come
I am building a Search function for a shopping cart site, which queries a
I am building a web application which allows visitors of a site to custom-build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.