Change index order in array (php)
Posted
by Trikks
on Stack Overflow
See other posts from Stack Overflow
or by Trikks
Published on 2010-04-24T09:52:31Z
Indexed on
2010/04/24
9:53 UTC
Read the original article
Hit count: 224
Hi
Been kind of stuck on this one for a while now, so any help would be appreciated. I have one array (left) that contains a list of elements, the goal is to sort another arrays (right) keys with the values from the left array.
The left array
Array
(
[0] => ID
[1] => FirstName
[2] => LastName
[3] => Address
)
The right array
Array
(
[0] => Array
(
[FirstName] => Pim
[Address] => Finland
[LastName] => Svensson
[ID] => 3
)
[1] => Array
(
[FirstName] => Emil
[Address] => Sweden
[LastName] => Malm
[ID] => 5
)
)
What I'm trying to accomplish would be similar to this
Array
(
[0] => Array
(
[ID] => 3
[FirstName] => Pim
[LastName] => Svensson
[Address] => Finland
)
Anyone? :) Oh, I'm running php 5.3, if it helps!
© Stack Overflow or respective owner