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 7801807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:03:34+00:00 2026-06-02T01:03:34+00:00

This is not the explode can solve I have several array $order data: {5,3,2}

  • 0

This is not the explode can solve

I have several array

$order
data: {5,3,2}

$title,
data: {USA, England, China}

$attribute
Same idea 

$type
Same idea 

The $order has already exist some value
{5,3,2} and
for each has its $title,$attribute,$type value correspondingly

eg. 5 USA  att5 type5

I would like to sort the order to {2,3,5} and the corresponding data in other array will be sorted too.

eg. {2,3,5}

For the array $title afterwards

is

{China, England,USA}

How to implement this for all arrays? Thank you

My idea is using an associative array , and i can sort the key, and everything is done. However, I can not generate the array

My idea array:

$records = array(5 => array("title" => "USA",   "att" => "add5"),
                 3 => array("title" => "England",  "att" => "add3"),
                 2 => array("title" => "China", "att" => "add2"));
  • 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-02T01:03:36+00:00Added an answer on June 2, 2026 at 1:03 am
    <?php
    
    $order = array(5, 3, 2);    // or $order = array("5", "3", "2");
    $title = array("USA", "England", "China");
    $att = array("Att 1", "Att 2", "Att 3");
    $type = array("Type 1", "Type 2", "Type 3");
    
    $records = array();
    foreach ($order as $i => $o) 
        $records[$o] = array("title" => $title[$i], "att" => $att[$i], "type" => $type[$i]);
    
    ksort($records, SORT_NUMERIC);
    
    print_r($records);
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This not a programming question but Most of the programmers using Eclipse should have
Under what circumstances would this or would this not be safe? I have a
I want to know i can do something similar to this (not working) code
If I have this code: $numbers = array_unique(explode(,, file_get_contents('text.txt'))); print_r($numbers); With this text file:
My head is about to explode after looking into why this is not working
Currently I am doing this: $lines = file('data/index'); foreach ($lines as $value) list($title, $location)
If I have this string: k6s6k6s6c1u6t661w651z6k6z6z6k611 How can delete all the characters in even-numbers
Sorry for this not being a real question, but Sometime back i remember seeing
I ask this not to start anything negative. Rather, after looking at ASP.NET MVC
why is this not ok? aContract = function(){}; aContract.prototype = { someFunction: function() {

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.