I know it’s a simple question, but I didn’t succeed in finding the answer, yet…
Which is the most effective way to group array elements respect to the values of another array in PHP?
Example:
names = [antonio, luigi, marco, stefano, gennaro, pino, lorenzo];
surnames = [bianchi, rossi, rossi, brambilla, rossi, rossi, brambilla];
expected result:
bianchi:
antonio
rossi:
luigi, marco, gennaro, pino
brambilla:
stefano, lorenzo
Try this
Output
Otherwise
Output