Okay, so i have an array that has this structure.
[0] => stdClass Object
(
[questionID] => 588
[count] => 2
[answer] => extremely-likely
)
[1] => stdClass Object
(
[questionID] => 588
[count] => 2
[answer] => extremely-unlikely
)
[2] => stdClass Object
(
[questionID] => 588
[count] => 1
[answer] => likely
)
[3] => stdClass Object
(
[questionID] => 588
[count] => 1
[answer] => neither
)
[4] => stdClass Object
(
[questionID] => 588
[count] => 1
[answer] => unsure
)
Okay so basically i first want to find the highest number (count) from this array.
So in the example above it would be 2.
Now with that highest number saved i want to work out the what percent of 2(the highest number) are the rest of the numbers.
So from my array above, [2] would be 50% of the highest number.
Now my efforts so far are shown below:
private function getFFT($region){
$fft = Question::getFFTCount($this->hw->id);
$numbers = [];
foreach($fft as $answer){
$numbers[] = $answer->count;
}
$findHighest = array_keys($numbers,max($numbers));
return $findHighest;
}
Now when i print_r($findHighest) i get the following.
Array
(
[0] => 0
[1] => 1
)
Does any one know how i can achieve this?.