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

  • Home
  • SEARCH
  • 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 8684499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:19:30+00:00 2026-06-12T22:19:30+00:00

For example, if these were my arrays: array (4) { [0] => 6, [1]

  • 0

For example, if these were my arrays:

array (4) {
  [0] => 6,
  [1] => 7,
  [2] => 8,
  [3] => 9
}

And:

array (4) {
  [0] => 10,
  [1] => 1,
  [2] => 3,
  [3] => 5
}

And this array, which I want to sort:

array (4) {
  [0] => 'foo1',
  [1] => 'foo2',
  [2] => 'foo3',
  [3] => 'foo4'
}

I would get this for the final result (after sorting):

array (4) {
  [0] => 'foo1',
  [1] => 'foo4',
  [2] => 'foo3',
  [3] => 'foo2'
}

Is this possible? Note that I got this final array by sorting the 3rd array provided by the sums of the same keys of the first two arrays.

Any help?

  • 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-06-12T22:19:31+00:00Added an answer on June 12, 2026 at 10:19 pm
    $arr1 = array(6,7,8,9);
    $arr2 = array(10,1,3,5);
    $arr3 = array('foo1','foo2','foo3','foo4');
    $arr = array();
    
    foreach($arr1 as $key => $item){
        $arr[] = $arr1[$key]  + $arr2[$key];
    }
    arsort($arr);
    
    $res = array();
    foreach($arr as $key => $value){
        $res[] = $arr3[$key];
    }
    
    print_r($res);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array with arrays in it, where I want to sort the
I want to scale images these day and find the following example: Example #1
This is the example code, I'm using these functions for a program, but scanf
I want to sort files by modification time ascending and descending. According to this
Since PHP doesn't provide real arrays, I want to create an array class myself.
I have array like below the page. I want to find array number which
In hirb tutorial there's an example for array: [[1,2], [2,3]] prints as +---+---+ |
Is there an equivalent for ruby's array[n..m] in JavaScript? For example: >> a =
Can anyone give me an example of these attributes in action: stroke-dasharray, stroke-linecap, stroke-linejoin
I'm trying to parse the values separated by commas in these 4 example sources

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.