I have an array of std objects.
I wish to rename them.
How do I do it?
Eg
Array(
[0] stdClass
key => values
[1] stdClass
key => values
[2] stdClass
key => values
)
How to rename the values 0, 1, 2 to something else?
--- Updated below ---
I'm using this now
foreach ($arr as $value) {
$new_arr[] = array('my_key' => $value);
}
But at the expense of an additional array dimension.
Was trying to change something like this
Array(
[0] stdClass
tid => 10
name => Category
[1] stdClass
tid => 11
name => Product
)
to...
Array(
[10] stdClass
tid => 10
name => Category
[11] stdClass
tid => 11
name => Product
)
var_dumpof a real array and an example of what you would like to change it to?