samedi 5 octobre 2019

loop through array - create new array from this

i have this array for example:

$array = [
  'foodTypes' => [
    'pizza' => '120',
    'burger' => [
      'calorie' => '50',
      'sugar' => '10'
      'prices' => [
        'regular' => '150',
        'discount' => '10'
      ]
    ]
  ]
];

i want to create loop through this array and create a new array from this (on the way i will check the value of each key and will make changes if i will need in some cases in the new array).

  • important: the array is unknown levels.


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire