473,809 Members | 2,940 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to sort 2 dimentional array in php

245 New Member
Hey all,
I need to sort 2 dimentional array.
My data is in this form

arrayName[0][0] = decimal value say 1
arrayName[1][0] = name say abc
arrayName[0][1] = decimal value say 2
arrayName[1][1] = name say def
arrayName[0][2] = decimal value say 3
arrayName[1][2] = name say xyz
arrayName[0][3] = decimal value say 4
arrayName[1][3] = name say ghi

I need to sort my array by name. is there any sorting method in php which sort my array or any custom solution.?

Kindly help out to sort my issue.
Oct 13 '09 #1
3 2429
Dormilich
8,658 Recognized Expert Moderator Expert
what about sort()?
____________
Oct 13 '09 #2
neovantage
245 New Member
how can i use that funtion in order to sort my array with second index of the array. can you give me an example by writing code here by using my example?
Oct 13 '09 #3
Dormilich
8,658 Recognized Expert Moderator Expert
@neovantage
you should already know that I don’t do that…

but you can have a generic example:
Expand|Select|Wrap|Line Numbers
  1. // pseudo code
  2. foreach (1st-level-array)
  3.     sort(2nd-level-array)
Oct 13 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2228
by: Cedric Baelemans | last post by:
Hi, I try to store a two-dimentional array in a session variable. When I do the same with a one-dimentional array, it works fine, but with a two-dimentional array it fails. Is this not possible? Is there something special I have to take into account? Any help is welcome Cedric
8
5137
by: Al | last post by:
I'd like to declare (in a Matrix class) a two-dimentional array with user-defined coordinates. The constructor is: Matrix(int c, int l): col(c), lin(l), a(new float) {} the compiler says 'lin' should be a constant, but I want it to be defined from the user, so what should I do? and how must 'a' be declared?? help me please
1
3247
by: rkmoray | last post by:
I have created a Multi Dimentional array, but having problems filling it. int mCount=0; mCount=ds.Tables.Rows.Count; string arrayppsa = new string ; DataTable myDataTable=ds.Tables; foreach(DataRow myDataRow in myDataTable.Rows) {
0
2466
by: Max M. Power | last post by:
I'm getting an InvalidOperationException calling Invoke with a method parameter object array that contains a two dimentional string array. More stack trace output below: // Create two dimentional array. System::String* tda = new System::String*; tda = "lastName"; tda = "Power"; tda = "firstName"; tda = "Max";
14
2361
by: ranjmis | last post by:
Hi all, Below is the code wherein I am initializing double dimentional array inside main with string literals. Now I want to display the strings using a function call to which I just want to pass the array as argument with no other info like number of strings. Is there a way to achieve that?
2
1154
ammoos
by: ammoos | last post by:
hi friends is there any built in function to sort a one dimentional array in asp.net thanks
3
2447
by: cmdolcet69 | last post by:
I can the following error message "value of type byte cannot be converted to 1-dimentional array of byte" when i execute this line of code: moRS232.Write(Packet(i)) it underline the packet(i) this is my declared array of byte size (6)
9
2468
by: Srinu | last post by:
Hi All, We know the following facts, 1. A two dimentional arrays in C is stored similar to a single dimentional array. 2. * is the dereference operator that gives value at address denoted by the operand to this operator. i.e *p is the value at address given by p. 3. In case of two dimentional array a, a+1 refers to the second
3
1472
by: theS70RM | last post by:
hey, I have a listing of active directory groups in an array by distinguished name, like so: myar "CN=my sub group, CN=my group, OU=myou" myar "CN=another subgroup, CN=my group, OU=myou" myar "CN=diff group, OU=myou" myar "CN=foo group, OU=ou2"
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10378
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4333
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.