Возникла проблема при написание скрипта, буду весьма благодарен если кто поможет.
Суть проблемы вот в чём:
Есть вот такой массив, мне нужно выделить в под массив, все холодные закуски и салаты.
Это своего рода массив категорий и нужно выделить под категории.
Dump => array(48) {
[0] => array(8) {
["id"] => string(1) "1"
["name"] => string(10) "АКЦИЯ"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[1] => array(8) {
["id"] => string(1) "4"
["name"] => string(10) "ОБЕДЫ"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[2] => array(8) {
["id"] => string(2) "10"
["name"] => string(68) "БЛЮДА ИЗ РЫБЫ СОБСТВЕННОГО ХОЗЯЙСТВА"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[3] => array(8) {
["id"] => string(2) "11"
["name"] => string(25) "РОЛЛЫ (СЫМАКИ)"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[4] => array(8) {
["id"] => string(2) "12"
["name"] => string(45) "ХОЛОДНЫЕ ЗАКУСКИ мясные"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[5] => array(8) {
["id"] => string(2) "13"
["name"] => string(46) "ХОЛОДНЫЕ ЗАКУСКИ овощные"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[6] => array(8) {
["id"] => string(2) "14"
["name"] => string(45) "ХОЛОДНЫЕ ЗАКУСКИ рыбные"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[7] => array(8) {
["id"] => string(2) "15"
["name"] => string(43) "САЛАТЫ мясные с курицей"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[8] => array(8) {
["id"] => string(2) "16"
["name"] => string(47) "САЛАТЫ мясные со свининой"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[9] => array(8) {
["id"] => string(2) "17"
["name"] => string(47) "САЛАТЫ мясные с телятиной"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[10] => array(8) {
["id"] => string(2) "18"
["name"] => string(44) "САЛАТЫ мясные Азиатские"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
результат должен получиться
Dump => array(48) {
[0] => array(8) {
["id"] => string(1) "1"
["name"] => string(10) "АКЦИЯ"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[1] => array(8) {
["id"] => string(1) "4"
["name"] => string(10) "ОБЕДЫ"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[2] => array(8) {
["id"] => string(2) "10"
["name"] => string(68) "БЛЮДА ИЗ РЫБЫ СОБСТВЕННОГО ХОЗЯЙСТВА"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[3] => array(8) {
["id"] => string(2) "11"
["name"] => string(25) "РОЛЛЫ (СЫМАКИ)"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[4] => array(8) {
["id"] => string(2) "12"
["name"] => string(45) "ХОЛОДНЫЕ ЗАКУСКИ"
["made"] => string(1) "5"
["sub"] => array(3) {
[0] => array(8) {
["id"] => string(2) "12"
["name"] => string(45) "ХОЛОДНЫЕ ЗАКУСКИ мясные"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[1] => array(8) {
["id"] => string(2) "13"
["name"] => string(46) "ХОЛОДНЫЕ ЗАКУСКИ овощные"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[2] => array(8) {
["id"] => string(2) "14"
["name"] => string(45) "ХОЛОДНЫЕ ЗАКУСКИ рыбные"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
}
}
[5] => array(8) {
["id"] => string(2) "12"
["name"] => string(45) "САЛАТЫ"
["made"] => string(1) "5"
["sub"] => array(3){
[0] => array(8) {
["id"] => string(2) "15"
["name"] => string(43) "САЛАТЫ мясные с курицей"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[1] => array(8) {
["id"] => string(2) "16"
["name"] => string(47) "САЛАТЫ мясные со свининой"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[9] => array(8) {
["id"] => string(2) "17"
["name"] => string(47) "САЛАТЫ мясные с телятиной"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
[10] => array(8) {
["id"] => string(2) "18"
["name"] => string(44) "САЛАТЫ мясные Азиатские"
["discount"] => string(1) "0"
["img"] => string(0) ""
["made"] => string(1) "5"
["dop1"] => string(0) ""
["dop2"] => string(0) ""
["x"] => string(0) ""
}
}
}