Sort multidimensional and Associative array by a deply nested array PHP -
i have multidimensional array fetch database , it's structured this:
array(session array(items array(databaseid (itemname, itemcategory, children, array(id1, id2, id3...) etc..))))
i not sure how write since i'm beginner hope struture. if want acess itemcategory of item, save item's databaseid in $databaseid , write:
$_session['items'][$databaseid]['itemcategory'];
if want array items children's databaseid write:
$_session['items'][$databaseid]['children'];
now, want sort array. have looked around don't understand how sort after want. sort whole
$_session['items']
according itemname instead of databaseid. @ possible? mean, itemname stored each databaseid...
i want use in order print items sorted name instead of databaseid.
thanks in advance.
edit: have tried
array_multisort($_session['items'], $_session['items']['databaseid']['itemname']);
but problem
$_session['items']['databaseid']['itemname']
is not array.
Comments
Post a Comment