We help IT Professionals succeed at work.

# Array ordering problem

on
242 Views
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);

etc.

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?
Comment
Watch Question
Commented:
This problem has been solved!
###### 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

Deciding to stick with EE.

Mohamed Asif

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

Carl Webster
CTP, Sr Infrastructure Consultant