Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 14th, 2004, 08:48 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default sort array of strings error

Could you please let me know how I can solve the following problem with array sort.

After I sort and delete duplicates from array $keywords_main of strings I get following changes to array elements:

CASE 1:
Before sort => [3, 5, 7]
sort:
$keywords_main = array_flip($keywords_main);
array_multisort($keywords_main);
$keywords_main = array_flip($keywords_main);

After sort => [0, 1, 2]

CASE 2:
(notice: there is space between 5 and 5 in second array element)
Before sort => [33, 5 5, 7]
sort:
$keywords_main = array_flip($keywords_main);
array_multisort($keywords_main);
$keywords_main = array_flip($keywords_main);

After sort => [ 0, 5 5, 1]

I would like to have array not change the value of its elements to the position number as it happens in this case. If array elements are words, then there is no problem.

Thank you,
Reply With Quote
  #2 (permalink)  
Old December 14th, 2004, 08:52 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm not sure if I posted to right forum...
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort unrelated strings johngavin XSLT 7 January 8th, 2008 07:49 AM
strings as array indexes cwalton Excel VBA 3 July 30th, 2007 02:50 AM
Array of Strings to dll jjd Excel VBA 2 February 26th, 2006 07:25 AM
Array of Strings jjd Visual C++ 1 June 23rd, 2005 02:56 PM
Sorting Array of date strings Arsi C# 4 October 22nd, 2004 04:18 PM



All times are GMT -4. The time now is 07:42 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.