Link to home
Start Free TrialLog in
Avatar of ClintonK
ClintonKFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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.
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ClintonK

ASKER

Thanks. That does the job perfectly!
Cheers.