Jump to content

how to exchange array keys


charles.ca

Recommended Posts

Hi ..

i have an array format like (mysql result array)

$new_array=Array ( [0] => Array ( [quantity] => 5 )  [1] => Array ( [quantity] => 25 )  [2] => Array ( [quantity] => 20 ) )

 

I have to convert this array into the following format

$new_array['quantity'][0]=5

$new_array['quantity'][1]=25

$new_array['quantity'][2]=20

 

 

How to convert this array format using any standard array method.

 

 

Link to comment
https://forums.phpfreaks.com/topic/215937-how-to-exchange-array-keys/
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.