Necuima 18 Posted May 3, 2017 Report 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 Quote Link to post Share on other sites
Necuima 18 Posted May 3, 2017 Author Report 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 Quote Link to post Share on other sites
Larry 428 Posted May 3, 2017 Report Share Posted May 3, 2017 Awesome. Kudos for figuring it out and thanks for letting us know! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.