using usort to re-arrange multi-dimension array
Posted
by
Thomas Bennett
on Stack Overflow
See other posts from Stack Overflow
or by Thomas Bennett
Published on 2012-12-18T23:01:18Z
Indexed on
2012/12/18
23:02 UTC
Read the original article
Hit count: 223
I have a large array:
[0] => stdClass Object
(
[products] => Array
(
[0] => stdClass Object
(
[body_html] => bodyhtml
[published_at] => 2012-12-16T23:59:18+00:00
[created_at] => 2012-12-16T11:30:24+00:00
[updated_at] => 2012-12-18T10:52:14+00:00
[vendor] => Name
[product_type] => type
)
[1] => stdClass Object
(
[body_html] => bodyhtml
[published_at] => 2012-12-16T23:59:18+00:00
[created_at] => 2012-12-16T10:30:24+00:00
[updated_at] => 2012-12-18T10:52:14+00:00
[vendor] => Name
[product_type] => type
)
)
)
and I need to arrange each of the products by the date they where created... I've tried and failed all kinds of usort, ksort, uksort techniques to try and get it to be in a specific order (chronological) but failed!
any guidance would be most appreciated
© Stack Overflow or respective owner