Jump to content

newb - a simple array , then sort it ?


Bansaw

Recommended Posts

 

I have an array I want to define in Php and then sort it.

I am pretty new to Php and don't know the syntax or what funcs to use.

 

Here's the array I want:

 

user_email, user_name, hours_worked_per_week, total_earned

 

There will be about 120 users, and I want to sort them ascending alphabetically  on  user_email

 

 

Link to comment
https://forums.phpfreaks.com/topic/260618-newb-a-simple-array-then-sort-it/
Share on other sites

thanks,

 

let's just say , for arguments sake, that I need to define an array with these elements:

user_email, user_name, hours_worked_per_week, total_earned

 

How do I define that array,  and then how do I sort if ascending alpha on user_email?

...

how the info gets into the array and what happens to it afterwards, let's leave to the side for the moment. :)

thanks,

 

let's just say , for arguments sake, that I need to define an array with these elements:

user_email, user_name, hours_worked_per_week, total_earned

 

How do I define that array,  and then how do I sort if ascending alpha on user_email?

...

how the info gets into the array and what happens to it afterwards, let's leave to the side for the moment. :)

 

Let's not do that. The reason is that understanding where the data is coming from and what the ultimate disposition of that data can have significant impact on the "best" solution. One thing that really irritates me is when someone on these forums asks for a solution without providing all the relevant information. Then, once a solution is provided, they provide some tidbit of information that they *thought* was not pertinent but which, consequently, completely changes the solution needed.

 

You don't even state "how" the user is inputting the information or how it is being received. Is the user entering data into individual fields for each piece of data for each user? Is there a csv or some other type of file input? And, again, what are you planning to DO with this data. having a user enter 120+ records of data for the sole purposes of sorting it and displaying it on screen without actually saving it sounds pretty worthless.

 

By the way, if this is a homework problem, which I'm thinking it is, we will be glad to help, but you have to at least show some attempt at the problem.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.