I want to create an new array with duplicated MAX value from an array
and put other duplicate value in an other array
$etudiant = array ('a'=>'2','b'=>'5', 'c'=>'6', 'd'=>'6', 'e'=>'2');
and i want this result
$MaxArray = array ('c'=>'6', 'd'=>'6');
$otherarray1 = array ('a'=>'2', 'e'=>'2');
Thank you !
First, find the maximum value:
Second, find values that appear more than once:
Lastly, check the original arrays for values matching either
$maxValueor values that are listed in$dups:You’ll get:
Note: I wasn’t sure if you wanted the
$MaxArrayto contain the maximum value elements only if it appears more than once in the source array. If so, just change themaxcall to: