.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Space Empires: IV & V (http://forum.shrapnelgames.com/forumdisplay.php?f=20)
-   -   PHP Help Needed (http://forum.shrapnelgames.com/showthread.php?t=10854)

Fyron December 6th, 2003 03:14 AM

Re: PHP Help Needed
 
Quote:

Originally posted by Ruatha:
</font><blockquote><font size="1" face="sans-serif, arial, verdana">quote:</font><hr /><font size="2" face="sans-serif, arial, verdana">Originally posted by Imperator Fyron:
Sorting a normal array is not a problem. I could just call the asort() function if that were the case. The problem is in sorting a 2D array.

<font size="2" face="sans-serif, arial, verdana">Yeah, that's what I meant with Multiarray, instead of simple array, my own vocabulary I guess.... </font><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">That was posted before your edit. http://forum.shrapnelgames.com/images/icons/icon12.gif

Fyron December 6th, 2003 03:15 AM

Re: PHP Help Needed
 
Quote:

How about making a simple 1D array also with only filenamess, and then sort that and let the multiarray (2D) follow in the sorting at the same time;
<font size="2" face="sans-serif, arial, verdana">That seems like overkill, and it seems like there should be some way to sort 2D arrays... but it is worth a shot. http://forum.shrapnelgames.com/images/icons/icon7.gif

[ December 06, 2003, 01:17: Message edited by: Imperator Fyron ]

Ruatha December 6th, 2003 03:16 AM

Re: PHP Help Needed
 
Quote:

Originally posted by Imperator Fyron:
</font><blockquote><font size="1" face="sans-serif, arial, verdana">quote:</font><hr /><font size="2" face="sans-serif, arial, verdana">Originally posted by Ruatha:
</font><blockquote><font size="1" face="sans-serif, arial, verdana">quote:</font><hr /><font size="2" face="sans-serif, arial, verdana">Originally posted by Imperator Fyron:
Sorting a normal array is not a problem. I could just call the asort() function if that were the case. The problem is in sorting a 2D array.

<font size="2" face="sans-serif, arial, verdana">Yeah, that's what I meant with Multiarray, instead of simple array, my own vocabulary I guess.... </font><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">That was posted before your edit. http://forum.shrapnelgames.com/images/icons/icon12.gif </font><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">Sometimes a new post can be the proper choice instead of an edit I guess...

Edit:especially in a fast post thread as this, I won't edit much more..

[ December 06, 2003, 01:16: Message edited by: Ruatha ]

Ruatha December 6th, 2003 03:17 AM

Re: PHP Help Needed
 
Quote:

Originally posted by Imperator Fyron:
</font><blockquote><font size="1" face="sans-serif, arial, verdana">quote:</font><hr /><font size="2" face="sans-serif, arial, verdana"> How about making a simple 1D array also with only filenamess, and then sort that and let the multiarray (2D) follow in the sorting at the same time;
<font size="2" face="sans-serif, arial, verdana">That seems like overkill, and it seems like there should be some way to support 2D arrays... but it is worth a shot. http://forum.shrapnelgames.com/images/icons/icon7.gif </font><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">I agree, there must be an easy way, easy if one knows it... http://forum.shrapnelgames.com/image...s/confused.gif

Ruatha December 6th, 2003 03:19 AM

Re: PHP Help Needed
 
http://se2.php.net/array_multisort

can this be the answer?

[ December 06, 2003, 01:22: Message edited by: Ruatha ]

Fyron December 6th, 2003 03:22 AM

Re: PHP Help Needed
 
Well.. that sorted them in a new order... not alphabetical though. http://forum.shrapnelgames.com/images/icons/icon9.gif

http://imagemod.spaceempires.net/indexmda.php

Maybe my selection sort is a bit off...

Looking at link now.

[ December 06, 2003, 01:22: Message edited by: Imperator Fyron ]

Ruatha December 6th, 2003 03:24 AM

Re: PHP Help Needed
 
Strange indeed!

Edit: I can't really see any logic in the sorting http://forum.shrapnelgames.com/images/icons/icon10.gif

[ December 06, 2003, 01:25: Message edited by: Ruatha ]

Fyron December 6th, 2003 03:25 AM

Re: PHP Help Needed
 
Now look at it when it is using multisort... almost in order, but not quite. http://forum.shrapnelgames.com/image...s/confused.gif

Ruatha December 6th, 2003 03:27 AM

Re: PHP Help Needed
 
I think this takes sleeping on.....

Fyron December 6th, 2003 03:27 AM

Re: PHP Help Needed
 
I fail to see a problem with this line:

array_multisort($fileArray, SORT_ASC, SORT_STRING);


All times are GMT -4. The time now is 02:50 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.