How to populate a two dimensional PHP array?

I'm using Wordpress and I have created a posts array using get_posts (a list of attachments IDs of type image).
This populates the array with the post IDs that I'm interested in. I would now like to add an associated item to each of the array entries so that I end up with something like this.
1234  ABCD
2343 FDRE
4324 HGRD

The first column is the postID and the second column is the associated string that I've added (from a lookup).
The reason for this is I would like to sort the array into ascending order on the second column which will then put my post IDs in the same order. When I display the images using the post ID, they will be displayed in the order defined by column 2.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris StanyonWebDevCommented:
Easiest option here may be to stick with a one-dimensional array, and to set the key to the ID:

$values = array();
$values[1234] = ABCD
$values[2343] = FDRE
$values[4324] = HGRD


foreach ($values as $id => $value):

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ClintonKAuthor Commented:
Thanks. That does the job perfectly!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.