I know similar questions to this have been asked, but even looking at all of them, I can't seem to get this to work. I think it's just a tad bit more complex than the other examples I'm finding. I know someone is going to say it's a repeat question - but I've tried really hard to get it from the examples I've seen so far - so sorry in advance!
So given this multidimensional array $results_display in PHP (var_dump below), there are 5 members of the sub-array "#results", and I want to sort (descending) those 5 by the value in the "#changed" string.
Can someone please help a girl out who's been banging her head against her desk for a couple days?
Thank you so much!!!
What I tried is below the var_dump. I commented out the part with the title to try and get just the first part working.
$results_display =
array(8) {
["#theme"]=> string(18) "hs_filters_results"
["#title"]=> string(18) "On-Demand Webinars"
["#body"]=> NULL
["#results"]=> array(5) {
[0]=> array(3) {
["#changed"]=> string(10) "1403279484"
["#theme"]=> string(17) "hs_filters_result"
["#result"]=> array(25) {
["#nid"]=> string(4) "2057"
["#node_type"]=> array(2) {
["machine_name"]=> string(7) "webinar"
["name"]=> string(7) "Webinar" }
["#title"]=> string(61) "7 Critical Reasons to Automate Handling of IBM i Spool Files "
["#brand_nid"]=> string(2) "29"
["#brand_machine_name"]=> string(5) "brand"
... }
}
...
}
// Obtain a list of columns for the results array
foreach ($results_display as $key => $row) {
$changed[$key] = $row['changed'];
//$title[$key] = $row['title'];
}
// Sort the data with date changed descending, title ascending
// Add $results_display as the last parameter, to sort by the common key
//array_multisort($changed, SORT_DESC, $title, SORT_ASC, $results_display);
array_multisort($changed, SORT_DESC, $results_display);