Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hi Larry,

 

The book describes how to use usort, etc., to sort a multi-dimensional array and that works great.

 

Is it possible to use something similar to sort a 2 dimensional array by its primary key whilst at the same time inserting some value into an existing field in each secondary array entry?  I want to insert a sequence number into the field in the secondary array as the primary key is not sequential for the purposes I have in mind.

 

Thanks in anticipation for your advice.

 

Cheers

Edited by Necuima
Link to comment
Share on other sites

Hi Larry,

 

After reading the advice in pages 4... more carefully, I found that a straight usort with the keys based on values within the secondary array gave me exactly what I was looking for.

 

Cheers

Link to comment
Share on other sites

 Share

×
×
  • Create New...