Function to find statistical mode
Posted on 2005-05-09
I am trying to create a function that will take an input of a list of numbers that are separated by spaces and output the statistical mode. The mode is the number that occurs most frequently in the set of numbers.
I have tried doing:
$data = array() ; // create empty array
$data = explode(" ", $datainput) ; // brake string into array
$mode = ???
I am not sure how to go through the data and find the value that is repeated most often though.
Thanks in advance