vendredi 18 mars 2016

creating subarrays with filltering main array results PHP

  {
    "id": 13,
    "name": "grapefruit",
    "lactose": "None",
    "fructose": "None",
    "polyols": "None",
    "fructan": "Moderate",
    "lactose_level": 1,
    "fructose_level": 1,
    "polyols_level": 1,
    "fructan_level": 2
  },
  {
    "id": 33,
    "name": "pomegranate",
    "lactose": "None",
    "fructose": "None",
    "polyols": "None",
    "fructan": "Moderate",
    "lactose_level": 1,
    "fructose_level": 1,
    "polyols_level": 1,
    "fructan_level": 2
  },

Above json array i'm getting from mysql query, what i want is to get seperate arrays from main json result set $fod, filtering each $level resuts,

Ex:

  • polyols :none set seperatly from $fod list

  • lactose :none set seperatly from $fod list

  • fructose :none set seperatly from $fod list

    • fructan :Moderate set seperatly from $fod list

    • fructan :High set seperatly from $fod list



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire