$var
is an array:
Array (
[0] => stdClass Object ( [ID] => 113 [title] => text )
[1] => stdClass Object ( [ID] => 114 [title] => text text text )
[2] => stdClass Object ( [ID] => 115 [title] => text text )
[3] => stdClass Object ( [ID] => 116 [title] => text )
)
Want to update it in two steps:
- Get
[ID]
of each object and throw its value to position counter (I mean[0], [1], [2], [3]
) - Remove
[ID]
after throwing
Finally, updated array ($new_var
) should look like:
Array (
[113] => stdClass Object ( [title] => text )
[114] => stdClass Object ( [title] => text text text )
[115] => stdClass Object ( [title] => text text )
[116] => stdClass Object ( [title] => text )
)
How to do this?
Thanks.