Is there any predefined function in any version of PHPs which could do this:
I have this array:
$arr = array(
2 => 'John',
21 => 'John',
32 => 'Joe',
42 => 'John',
23 => 'Joe',
62 => 'John',
25 => 'Joe',
);
I expect this result:
array(
'John' => array(2, 21, 42, 62),
'Joe' => array(32, 23, 25),
);
array_flip doesn't do what I want.
Note: I can write a custom code to do that and it's easy. My question is if there is a function in PHP can do it?
Last update: I think the answer should be NO