Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.