lundi 21 décembre 2020

add and sort two array in php [closed]

i have following two arrays, like

{
  "data": [
    {
      "filename": "a.jpg"
    },
    {
      "filename": "b.jpg"
    },
    {
      "filename": "c.jpg"
    },
  ],

  "video": [
    {
      "url": "a.mp4"
    },
    {
      "url": "b.mp4"
    }
  ],
}

and i need like this

{
  "data": [
        {
          "filename": "a.jpg"
        }
   ],

   "video": [
        {
          "url": "a.mp4"
        }
    ],
    "data": [
        {
          "filename": "b.jpg"
        }
    ]

    "video": [
        {
          "url": "b.mp4"
        }
    ],

    "data": [
        {
          "filename": "c.jpg"
        },
    ],

    "video": [
        {
          "url": "a.mp4"
        }
    ],  
}

after each data[] i want video[]. video array shoud be repeat if they have limit. is it possible to write code for this type array.

i know this is too much complicated , but i really dont understand how can i write code for this array.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire