We help IT Professionals succeed at work.
Get Started

Array ordering problem

thepadders asked
Last Modified: 2006-11-17
Have an array ordering problem.

I have two arrays. The first is just a simpe one dimensional array like:

$A = array(1,4,6,2,45,234,45);

A, is the order of the elements, ie 1 is first, 4 is second etc.

Now, the 2nd array is of the form:

$B[] = array(x, y, z);
$B[] = array(a, b, c);


What I am trying to do is sort array B. the first element will be found in $A, ie x and a would appear inside $A.

Thus the idea is to sort $B based on $A. where all the first elements of the arrays of B will be in $A and that determines the order.

Any ideas?
Watch Question
This problem has been solved!
Unlock 1 Answer and 12 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE