Orionsbelter Posted March 22, 2009 Share Posted March 22, 2009 ok am very stuck here look at the below example $rand1=rand(1,10); $rand2=rand(1,10); $rand3=rand(1,10); i now want a function or some way of outting the this 1st: (highest $rand) 2nd: (2nd highest $rand) 3rd: (lowest $rand) help Quote Link to comment https://forums.phpfreaks.com/topic/150616-order-3-totals-from-highest-to-low/ Share on other sites More sharing options...
Maq Posted March 22, 2009 Share Posted March 22, 2009 Use something like: $rand[]=rand(1,10); $rand[]=rand(1,10); $rand[]=rand(1,10); asort($rand); print_r($rand); Quote Link to comment https://forums.phpfreaks.com/topic/150616-order-3-totals-from-highest-to-low/#findComment-791147 Share on other sites More sharing options...
Orionsbelter Posted March 22, 2009 Author Share Posted March 22, 2009 it'll be three different variables Quote Link to comment https://forums.phpfreaks.com/topic/150616-order-3-totals-from-highest-to-low/#findComment-791148 Share on other sites More sharing options...
trq Posted March 22, 2009 Share Posted March 22, 2009 it'll be three different variables Then you need to put those three different variables into an array so you can sort them. Quote Link to comment https://forums.phpfreaks.com/topic/150616-order-3-totals-from-highest-to-low/#findComment-791153 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.