Jump to content

[SOLVED] Quick array question


tmh766

Recommended Posts

If you have a multi array such as:

 

$myArray = array();

 

#For example prices.

$myArray[0][0] = 68.4;

$myArray[0][1] = 100.2;

$myArray[0][2] = 34.2;

 

#For example name.

$myArray[1][0] = "Orange";

$myArray[1][1] = "Lemon";

$myArray[1][2] = "HotPocket";

 

how do you implement sort() to put the array in decending price order while keeping the name with the price to look like this:

 

#For example sorted prices.

$myArray[0][0] = 100.2;

$myArray[0][1] = 68.4;

$myArray[0][2] = 34.2;

 

#For example name.

$myArray[1][0] = "Lemon";

$myArray[1][1] = "Orange";

$myArray[1][2] = "HotPocket";

 

 

Link to comment
https://forums.phpfreaks.com/topic/37075-solved-quick-array-question/
Share on other sites

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.