noob php help

  • Started 13 years ago
  • Last post 13 years ago
  • 1 Response
  • Stugoo

    Hi all, working out how to handle a server response over here and I am a real newbie with PHP.

    The response I am getting, is numerous simple arrays that looks like the following :
    [ "1", "Apples", "Fruit" ]
    [ "1", "Banannas", "Fruit" ]
    [ "1", "Pears", "Fruit" ]
    [ "1", "Potatoes", "Veg" ]
    ...

    I want to push all of these into one array, json_encode it and return it to the front end.
    hopefully something like

    {
    "0" : [ "1", "Apples", "Fruit" ],
    "1" : [ "1", "Banannas", "Fruit" ],
    "2" : [ "1", "Pears", "Fruit" ],
    ...

    }

    Can anyone help?

  • Stugoo0