Jump to content

Recommended Posts

Hi I've a bit of a puzzle that perhaps someone knows better than me if not i'll keep hunting. I basically have two arrays with different fields in them that I need to display in date order. I was thinking the best thing to do would be to combine them then sort them then to display do a foreach on them. Question is how do I select which field the arrays get sorted by? both have a date field but with different titles i.e. crt_insert_date & claim_insert_date can I select to sort by both?

 

Any ideas would be really great - thanks!

usort

 

what that will do is pull up two results from the array at a time.. if you have a multi-dimensional array such as..

 

array (

  [0] => array (

    ['whatever'] => "lol"

    ['whatever'] => "lol"

    ['whatever'] => "lol"

  )

  [1] => array (

    ['whatever'] => "lol"

    ['whatever'] => "lol"

    ['whatever'] => "lol"

  )

)

 

it will pull up two elements from the arrays.. not the more inward arrays.. so inside of the callback function you will compare the fields inside of the arrays passed into the callback function against eachother and return -1 0 or 1 depending on whether to push back.. leave in place.. or send forward..

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.