I have arrays:
'response' => array ( 0 => array ( 'barcode' => '', 'category_name' => 'Кофе', 'unit' => 'kg', 'cost' => '791', 'fiscal' => '0', 'hidden' => '0', 'menu_category_id' => '1', 'workshop' => '1', 'nodiscount' => '0', 'photo' => '/upload/pos_cdb_7631/menu/product_1464608672_3.jpg', 'photo_origin' => '/upload/pos_cdb_7631/menu/product_1464608672_3_original.jpg', 'price' => array ( 1 => '3000', 2 => '3000', ), 'product_code' => '', 'product_id' => '3', 'product_name' => 'Капучино 250 мл', 'profit' => array ( 1 => '2209', 2 => '2209', ), 'sort_order' => '999', 'tax_id' => '0', 'product_tax_id' => '0', 'type' => '2', 'weight_flag' => '0', 'color' => 'white', 'spots' => array ( 0 => array ( 'spot_id' => '1', 'price' => '3000', 'profit' => '2209', 'visible' => '0', ), 1 => array ( 'spot_id' => '2', 'price' => '3000', 'profit' => '2209', 'visible' => '0', ), ), 'ingredient_id' => '0', 'out' => 248, 'product_production_description' => '', 'ingredients' => array ( 0 => array ( 'structure_id' => '52', 'ingredient_id' => '10', 'pr_in_clear' => '0', 'pr_in_cook' => '0', 'pr_in_fry' => '0', 'pr_in_stew' => '0', 'pr_in_bake' => '0', 'structure_unit' => 'l', 'structure_type' => '1', 'structure_brutto' => 30, 'structure_netto' => 30, 'structure_lock' => '1', 'structure_selfprice' => '2', 'ingredient_name' => 'Вода', 'ingredient_unit' => 'l', 'ingredient_weight' => 0, 'ingredients_losses_clear' => '0', 'ingredients_losses_cook' => '0', 'ingredients_losses_fry' => '0', 'ingredients_losses_stew' => '0', 'ingredients_losses_bake' => '0', ), 1 => array ( 'structure_id' => '53', 'ingredient_id' => '9', 'pr_in_clear' => '0', 'pr_in_cook' => '0', 'pr_in_fry' => '0', 'pr_in_stew' => '0', 'pr_in_bake' => '0', 'structure_unit' => 'kg', 'structure_type' => '1', 'structure_brutto' => 8, 'structure_netto' => 8, 'structure_lock' => '1', 'structure_selfprice' => '232', 'ingredient_name' => 'Кофе', 'ingredient_unit' => 'kg', 'ingredient_weight' => 0, 'ingredients_losses_clear' => '0', 'ingredients_losses_cook' => '0', 'ingredients_losses_fry' => '0', 'ingredients_losses_stew' => '0', 'ingredients_losses_bake' => '0', ), 2 => array ( 'structure_id' => '54', 'ingredient_id' => '8', 'pr_in_clear' => '0', 'pr_in_cook' => '0', 'pr_in_fry' => '0', 'pr_in_stew' => '0', 'pr_in_bake' => '0', 'structure_unit' => 'l', 'structure_type' => '1', 'structure_brutto' => 150, 'structure_netto' => 210, 'structure_lock' => '0', 'structure_selfprice' => '330', 'ingredient_name' => 'Молоко', 'ingredient_unit' => 'l', 'ingredient_weight' => 0, 'ingredients_losses_clear' => '0', 'ingredients_losses_cook' => '0', 'ingredients_losses_fry' => '0', 'ingredients_losses_stew' => '0', 'ingredients_losses_bake' => '0', ), 3 => array ( 'structure_id' => '55', 'ingredient_id' => '7', 'pr_in_clear' => '0', 'pr_in_cook' => '0', 'pr_in_fry' => '0', 'pr_in_stew' => '0', 'pr_in_bake' => '0', 'structure_unit' => 'p', 'structure_type' => '1', 'structure_brutto' => 1, 'structure_netto' => 0, 'structure_lock' => '1', 'structure_selfprice' => '190', 'ingredient_name' => 'Бумажные стаканы 250 мл', 'ingredient_unit' => 'p', 'ingredient_weight' => 0, 'ingredients_losses_clear' => '0', 'ingredients_losses_cook' => '0', 'ingredients_losses_fry' => '0', 'ingredients_losses_stew' => '0', 'ingredients_losses_bake' => '0', ), 4 => array ( 'structure_id' => '56', 'ingredient_id' => '6', 'pr_in_clear' => '0', 'pr_in_cook' => '0', 'pr_in_fry' => '0', 'pr_in_stew' => '0', 'pr_in_bake' => '0', 'structure_unit' => 'p', 'structure_type' => '1', 'structure_brutto' => 1, 'structure_netto' => 0, 'structure_lock' => '1', 'structure_selfprice' => '15', 'ingredient_name' => 'Крышка 250 мл', 'ingredient_unit' => 'p', 'ingredient_weight' => 0, 'ingredients_losses_clear' => '0', 'ingredients_losses_cook' => '0', 'ingredients_losses_fry' => '0', 'ingredients_losses_stew' => '0', 'ingredients_losses_bake' => '0', ), 5 => array ( 'structure_id' => '57', 'ingredient_id' => '5', 'pr_in_clear' => '0', 'pr_in_cook' => '0', 'pr_in_fry' => '0', 'pr_in_stew' => '0', 'pr_in_bake' => '0', 'structure_unit' => 'p', 'structure_type' => '1', 'structure_brutto' => 1, 'structure_netto' => 0, 'structure_lock' => '1', 'structure_selfprice' => '22', 'ingredient_name' => 'Размешиватель', 'ingredient_unit' => 'p', 'ingredient_weight' => 0, 'ingredients_losses_clear' => '0', 'ingredients_losses_cook' => '0', 'ingredients_losses_fry' => '0', 'ingredients_losses_stew' => '0', 'ingredients_losses_bake' => '0', ), ), ), 1 => array ( 'barcode' => '', 'category_name' => 'Кофе', 'unit' => 'kg', 'cost' => '805', 'fiscal' => '0', 'hidden' => '0', 'menu_category_id' => '1', 'workshop' => '2', 'nodiscount' => '0', 'photo' => '/upload/pos_cdb_7631/menu/product_1464251849_5.jpg', 'photo_origin' => '/upload/pos_cdb_7631/menu/product_1464251849_5_original.jpg', 'price' => array ( 1 => '1600', 2 => '1600', ), 'product_code' => '', 'product_id' => '5', 'product_name' => 'Круассан с шоколадом', 'profit' => array ( 1 => '795', 2 => '795', ), 'sort_order' => '999', 'tax_id' => '0', 'product_tax_id' => '0', 'type' => '2', 'weight_flag' => '0', 'color' => 'white', 'spots' => array ( 0 => array ( 'spot_id' => '1', 'price' => '1600', 'profit' => '795', 'visible' => '0', ), 1 => array ( 'spot_id' => '2', 'price' => '1600', 'profit' => '795', 'visible' => '0', ), ), 'ingredient_id' => '0', 'out' => 190, 'product_production_description' => '', 'ingredients' => array ( 0 => array ( 'structure_id' => '62', 'ingredient_id' => '17', 'pr_in_clear' => '0', 'pr_in_cook' => '0', 'pr_in_fry' => '0', 'pr_in_stew' => '0', 'pr_in_bake' => '0', 'structure_unit' => 'kg', 'structure_type' => '1', 'structure_brutto' => 30, 'structure_netto' => 30, 'structure_lock' => '1', 'structure_selfprice' => '360', 'ingredient_name' => 'Шоколад черный', 'ingredient_unit' => 'kg', 'ingredient_weight' => 0, 'ingredients_losses_clear' => '0', 'ingredients_losses_cook' => '0', 'ingredients_losses_fry' => '0', 'ingredients_losses_stew' => '0', 'ingredients_losses_bake' => '0', ), 1 => array ( 'structure_id' => '63', 'ingredient_id' => '4', 'pr_in_clear' => '0', 'pr_in_cook' => '0', 'pr_in_fry' => '0', 'pr_in_stew' => '0', 'pr_in_bake' => '0', 'structure_unit' => 'kg', 'structure_type' => '2', 'structure_brutto' => 130, 'structure_netto' => 160, 'structure_lock' => '0', 'structure_selfprice' => '445', 'ingredient_name' => 'Тесто для круассанов', 'ingredient_unit' => 'kg', 'ingredient_weight' => 0, 'ingredients_losses_clear' => '0', 'ingredients_losses_cook' => '0', 'ingredients_losses_fry' => '0', 'ingredients_losses_stew' => '0', 'ingredients_losses_bake' => '0', ), ), ), 2 => array ( 'barcode' => '', 'category_name' => 'Кофе', 'unit' => 'kg', 'cost' => '15', 'fiscal' => '0', 'hidden' => '0', 'menu_category_id' => '1', 'workshop' => '0', 'nodiscount' => '0', 'photo' => '', 'photo_origin' => NULL, 'price' => array ( 1 => '16681', 2 => '16681', ), 'product_code' => '', 'product_id' => '10', 'product_name' => 'Что то', 'profit' => array ( 1 => '16666', 2 => '16666', ), 'sort_order' => '999', 'tax_id' => '0', 'product_tax_id' => '0', 'type' => '2', 'weight_flag' => '0', 'color' => 'white', 'spots' => array ( 0 => array ( 'spot_id' => '1', 'price' => '16681', 'profit' => '16666', 'visible' => '1', ), 1 => array ( 'spot_id' => '2', 'price' => '16681', 'profit' => '16666', 'visible' => '1', ), ), 'ingredient_id' => '0', 'out' => 0, 'product_production_description' => '', 'ingredients' => array ( 0 => array ( 'structure_id' => '66', 'ingredient_id' => '6', 'pr_in_clear' => '0', 'pr_in_cook' => '0', 'pr_in_fry' => '0', 'pr_in_stew' => '0', 'pr_in_bake' => '0', 'structure_unit' => 'p', 'structure_type' => '1', 'structure_brutto' => 1, 'structure_netto' => 0, 'structure_lock' => '1', 'structure_selfprice' => '15', 'ingredient_name' => 'Крышка 250 мл', 'ingredient_unit' => 'p', 'ingredient_weight' => 0, 'ingredients_losses_clear' => '0', 'ingredients_losses_cook' => '0', 'ingredients_losses_fry' => '0', 'ingredients_losses_stew' => '0', 'ingredients_losses_bake' => '0', ), ), ), ), ) How can I process automatically (since there may be a lot of them) array and display all ingredient_name separated by comma in the product card, and at the end with a period?
Gotta get
<div> Вода, кофе, молоко, Стакан </div> <div> Вода, кофе, молоко, Стакан </div> <div> Что-то, что-то еще, молоко, Стакан </div>
print_r()print and publish array dumps withvar_export(). The difference is that to work with your published version of the array, you will still need to “finish” it, which is of no interest to anyone, and therefore you can wait longer for the help. - Edwardingredient_name? - u_mulder