Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9240331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:10:12+00:00 2026-06-18T08:10:12+00:00

Basically i need to sort some data into the top 5 best sales. I’ve

  • 0

Basically i need to sort some data into the top 5 best sales.
I’ve managed to group the 3 arrays i’ve used using.

$c = array_combine($PriceArray,$namesArray,$ProductArray);
krsort($c); 

Price array being the total. (Bit of a silly name, i just realised)
namesarray is the array of names
and product array is the list of product codes

I need to print it in a table like

“|£3.45|Jelly Beans | 120|”
so they have their own column, but at the moment it’s printing it like
| 3.45| array | array|

and i use

 echo '<td>'.$ProductArray[$i].'</td>'.'<td>'.$year.'</td>'.'<td>'.array_keys($c,$c[$i]).'<td>'. $PriceArray[$i].'</td>';

to print it.

Thanks in advance

    Array
    (

    [0] => 77358.47
    [1] => 111004.98
    [2] => 227194.9
    [3] => 84645.75
    [4] => 29693.58
    [5] => 198867.2
    [6] => 110779.5
    [7] => 210530.62
    [8] => 102916.79
    [9] => 186630.75
    [10] => 140143.24
    [11] => 48984.48
    [12] => 74759.34
    [13] => 204793.14
    [14] => 82192.5
    [15] => 167402.7
    [16] => 58232.72
    [17] => 216302.32
    [18] => 26353.92
    [19] => 149993.1

)

Array
(
    [0] => Jelly beans
    [1] => Banana milkshake powder
    [2] => Edam Cheese
    [3] => Hairnet
    [4] => Aubergine jam
    [5] => White bread
    [6] => Brown bread
    [7] => Purple bread
    [8] => Plain flour
    [9] => Striped flour
    [10] => Soft tissues
    [11] => Anti personnel mines
    [12] => Chicken fillets
    [13] => Beef cubes
    [14] => Marshmallows
    [15] => Fizzy carrot juice
    [16] => Low fat lard
    [17] => Suet dumpling mix
    [18] => Gravy powder
    [19] => Cherry pie filling
)
Array
(
    [0] => 121
    [1] => 122
    [2] => 123
    [3] => 124
    [4] => 125
    [5] => 126
    [6] => 127
    [7] => 128
    [8] => 129
    [9] => 130
    [10] => 131
    [11] => 132
    [12] => 133
    [13] => 134
    [14] => 135
    [15] => 136
    [16] => 137
    [17] => 138
    [18] => 139
    [19] => 140

)
Product Code Year Name Sales Total

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:10:13+00:00Added an answer on June 18, 2026 at 8:10 am

    Just put the keys and values into new arrays.

    $NewNamesArray = array_values($c); $NewPriceArray = array_keys($c)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I need some sort of library/set of functions that will allow me to
Basically need to generate custom(some different then yes no) messeges(alert) in JS , how
I basically need a custom function to be used only when, for example, the
Basically I need to capture the video from videocamera do some processing on frames
I have an ancient webpage that I need to instill some databasing capabalities into
I need some advice regarding how to organize my data for effective and fast
I'm probably going to need some sort of jquery or JS to accomplish this,
basically need to change the value that - admin_url() returns any idea?
I basically need to get user input: gets.chomp(input?) And then to convert the given
I basically need to check if there is an easier way to do this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.