Current location: Hot Scripts Forums » Programming Languages » PHP » natcasesort() Problem


natcasesort() Problem

Reply
  #1 (permalink)  
Old 04-15-06, 08:21 AM
DAL's Avatar
DAL DAL is offline
Code Master
 
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
natcasesort() Problem

Hi Forum

I got problems with using natcasesort()
its supposed to sort an array out alphanumeric characters yet when I try it doesnt do anything.

I have an multidim array myarray[][]. I want to sort by a row in that array but the natcasesort() doesnt let me tell it what to sort. it just apparnetly sorts.

Can anyone suggest what I should use here.

I have myarray setup to hold something like the following

myarray[1][numeric_ref]
myarray[1][title]
myarray[1][cost]
myarray[2][numeric_ref]
myarray[2][title]
myarray[2][cost]
myarray[3][numeric_ref]
myarray[3][title]
myarray[3][cost]
myarray[4][numeric_ref]
myarray[4][title]
myarray[4][cost]

how do I tell this natcasesort() to sort by the title (array[#][2])

I keep thinking there are ways to do this but then realise Im thinking of another programming language...anyone have this proglem
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
Reply With Quote
  #2 (permalink)  
Old 04-15-06, 08:52 AM
DAL's Avatar
DAL DAL is offline
Code Master
 
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
Ive just had a thought (insert insult here)

why not just
$i = 0;
while($i < 10)
{
natcasesort($searchresults[$i][1]);
$i ++;
}

so this would go through 10 elements with reference to the title @ elelment 1

but no I got this error;

Warning: natcasesort(): The argument should be an array

I think Im lost, whats an array again, is that not what Im referencing???
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie found a solution to a date problem. mickey_kamer Perl 4 05-09-07 05:54 AM
Problem in donwloading document using header tejash PHP 3 11-19-05 02:48 AM
Weird mysql_query and Smarty problem Canglan PHP 3 11-15-05 08:49 PM
Count problem kasic ASP.NET 1 10-20-04 12:23 AM
Asp and Microsoft Access 2002 problem gop373 ASP 2 10-06-04 09:13 AM


All times are GMT -5. The time now is 07:09 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.