Necuima Posted May 3, 2017 Share Posted May 3, 2017 (edited) 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 May 3, 2017 by Necuima Link to comment Share on other sites More sharing options...
Necuima Posted May 3, 2017 Author Share Posted May 3, 2017 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 More sharing options...
Larry Posted May 3, 2017 Share Posted May 3, 2017 Awesome. Kudos for figuring it out and thanks for letting us know! Link to comment Share on other sites More sharing options...
Recommended Posts