Skip to main content
The 2024 Developer Survey results are live! See the results

Timeline for PHP Get Highest Value from Array

Current License: CC BY-SA 3.0

7 events
when toggle format what by license comment
Jan 10, 2023 at 11:52 comment added Syed M. Sannan @mickmackusa I see
Jan 10, 2023 at 0:50 comment added mickmackusa @Stranger ...which is not necessary for this question/page. A loop (instead of sorting) will be "linear" and therefore will boast better performance.
Aug 5, 2022 at 11:31 comment added Syed M. Sannan @chandru Which is good or bad?
Nov 15, 2021 at 16:35 comment added chandru If we use sort() or asort() it may lead to time complexity with n nodes
Aug 23, 2019 at 0:06 comment added gman_donster Jacob is right - doing an asort will reorder the array lowest to highest maintaining keys...then do a foreach and the $key=>$value from that will be set to the highest pair after the foreach completes..so you have the highest one right there - the key and the value...
Jul 13, 2011 at 9:43 comment added Jacob If you don't need the whole array sorted, use one of the gazillion other answers obviously ;) But mentioning sort() made me think you phrased your question wrong.
Jul 13, 2011 at 9:25 history answered Jacob CC BY-SA 3.0