0

Using this snippet:

$array = array(1,2,3,4,5,6,7,8,9,10);
echo max($array);

i get:

10

But how to get the three highest values from this array, so the output will be:

10,9,8

in this order. Anybody know how to customize the max-function?

Greetings!

1
  • 1
    lol u should have asked how to get 4 highest values :) Commented Apr 7, 2014 at 20:34

1 Answer 1

1
  $array = array(1,2,3,4,5,6,7,8,9,10);
  rsort($array);
  echo $array[0]," ", $array[1], " ", $array[2];
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.