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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -