I've got an array with some objects in it that has a key called "day" and my problem is that, if I got more then one object that has the same value in the key "day" I need to map these objects to a new array within the orginal array.
Array
$arr = [
{
title: 'Hello',
day: 1
},
{
title: 'Hello2',
day: 1
},
{
title: 'Hello3',
day: 3
},
]
If many objects has same value in key "day", expected result:
$arr = [
[
{
title: 'Hello',
day: 1
},
{
title: 'Hello2',
day: 1
},
],
{
title: 'Hello3',
day: 3
},
]
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire