How can I sort this json data in php?
I'm trying to display only the menu__item_name in foreach it's working.
but I don't knw how to sort data.
I want to sort this JSON array by menu_item_sort
?
How can I do that?
I'm using the below code to display menu__item_name
$obj = json_decode($list->mi_des);
$Name =$obj->{'menu__item_name'};
$arr_name = array($Name);
$arr_name_imp = implode(" ",$arr_name);
$arr_name_exp = explode("|",$arr_name_imp);
foreach($arr_name_exp as $i =>$key) {
echo $key;
}
The data
{
"menu__item_name":"test1|test2|test3",
"menu_item_price":"775.00|100|30",
"menu_item_description":"Melon Ball |Big mac|cocke",
"menu_item_sort":"1|3|2",
"menu_item_status":"1|1|1",
"menu_item_display":"1|1|0"
}
Thanks in advance.