Jump to content
Larry Ullman's Book Forums
Sign in to follow this  

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...