group php array on strlen closed to the $limit variable

Questionsgroup php array on strlen closed to the $limit variable
Jehal Desai Staff asked 4 years ago

Need some help. I want to group my array based on strlen that is closed to the $limit and sort on total length
My array looks likes this:

so for example i want to sum the best option that is close to 29.
So ideally this is the combinations that i want to find
Cornering Brake Control(23) + Isofix(6) = length 29
Dynamic brake light(19) + Rainsensor(10) = 29
Hill Start Assist(17) + Parkinghelp(11) = 28
Led light = 90
My final array should look something like this:


View on Stack Overflow