Merging multiple array then sorting by array value count

Posted by Sofyan on Stack Overflow See other posts from Stack Overflow or by Sofyan
Published on 2010-04-29T10:44:36Z Indexed on 2010/04/29 15:47 UTC
Read the original article Hit count: 285

Filed under:
|
|

Hi,

Please help me, i need to merge multiple arrays then sorting it by array value count. Below is the problem:

$array1 = array("abc", "def", "ghi", "jkl", "mno");
$array2 = array("mno", "jkl", "mno", "ghi", "pqr", "stu");
$array3 = array_merge($array1, $array2);
$array4 = ???

print_r($array4);

I want the returns of $array4 like this:

Array
(
[0] => mno
[1] => ghi
[2] => jkl
[3] => abc
[4] => def
[5] => pqr
[6] => stu
)

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays