Here’s my array
Array
(
[_id] => MongoId Object
(
[$id] => 4ff6e96bb0b4599016000006
)
[alias] => me
[create] => 1341581675
[name] => It's Me!
)
I set [id] => 4ff6e96bb0b4599016000006 and unset [_id]
Now
Array
(
[alias] => me
[create] => 1341581675
[name] => It's Me!
[id] => 4ff6e96bb0b4599016000006
)
What’s the best way to order [id] on top and order [create] after [name]
Thanks
Instead of setting
$yourArray['id'] = '4ff6e9...0006', you could (ab)usearray_merge()to add it:This should basically append your original array to the small array above which contains only the key ‘id’.