I've an array of arrays in which I've 2 values in each array first one is personID and second one is Skill, there are multiple skills of same persons I need all same skills to add in an array with single person id. I can't figure how to do it.
Raw Data With Duplicate IDs
$data = array(
array(1, "Writing"),
array(3, "Designing"),
array(1, "Problem Solving"),
array(3, "Communication"),
array(5, "Writing"),
array(5, "Planning and organising"),
array(5, "Communication"),
array(1, "Designing"),
array(2, "Leadership"),
array(2, "Communication"),
array(2, "Designing")
);
Need Data Format With Unique Person IDs
$data = array(
array(1, "Writing", "Problem Solving", "Designing"),
array(3, "Designing", "Communication"),
array(5, "Writing", "Planning and organising", "Communication"),
array(2, "Leadership", "Communication", "Designing")
)
You can loop through the input array $data and build a new array - in this case $dataCombined - with the combined second values: