Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 28th, 2004, 08:50 AM
Authorized User
 
Join Date: Oct 2003
Location: KL, wilayah persekutuan, Malaysia.
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default sort numbers

i would like to sort an array in decreasing order but don't know how.
$Sales = array (37, 57, 64, 58, 100, 76, 120);
given the array above, could someone please write me the code how to sort it into 120, 100, 76, 64, 58, 57, 37?

  #2 (permalink)  
Old January 28th, 2004, 02:06 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

http://www.php.net/rsort

That server is down right now, perhaps you should use a mirror:
  http://my.php.net/rsort


$sorted_sales = rsort($Sales, SORT_NUMERIC);


Take care,

Nik
http://www.bigaction.org/


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic sort order or sort datatype kapy_kal XSLT 2 September 18th, 2007 02:10 PM
VBA Column Sort Order and numbers Jack1000 BOOK: Access 2003 VBA Programmer's Reference 1 October 5th, 2006 10:53 PM
how to sort cross tab.sort based on row total joxa83 Crystal Reports 7 March 2nd, 2006 09:12 AM
Sort @* sheila XSLT 2 July 17th, 2005 04:01 PM
Unable to sort using xsl sort command sly_jimmy_boy XSLT 3 June 17th, 2005 05:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.