I mentioned my php array object following below,
$arr ='[
{
"id": 4667,
"brand": "Michelin",
"model": "Pilot Super Sport",
"width": "255",
"height": "35",
"rim": "19",
},
{
"id": 4668,
"brand": "Michelin",
"model": "Pilot Super Sport",
"width": "275",
"height": "35",
"rim": "19",
},
{
"id": 4669,
"brand": "Pirelli",
"model": "Zero",
"width": "255",
"height": "35",
"rim": "19",
},
{
"id": 4670,
"brand": "Pirelli",
"model": "Zero",
"width": "275",
"height": "35",
"rim": "19",
}]';
I want to split array into front and rear separate like following below based on width.
$front = '[
{
"id": 4667,
"brand": "Michelin",
"model": "Pilot Super Sport",
"width": "255",
"height": "35",
"rim": "19",
},
{
"id": 4669,
"brand": "Pirelli",
"model": "Zero",
"width": "255",
"height": "35",
"rim": "19",
}]';
$rear = '[
{
"id": 4668,
"brand": "Michelin",
"model": "Pilot Super Sport",
"width": "275",
"height": "35",
"rim": "19",
},
{
"id": 4670,
"brand": "Pirelli",
"model": "Zero",
"width": "275",
"height": "35",
"rim": "19",
}]';
It's there any way php can compare each object width value and group them which is match. please advise. thanks for your valuable time.