I have array in my MongoDB document. When im'm printing it in PHP (print_r($user->__next_action);
) i got
MongoDB\Model\BSONDocument Object
(
[storage:ArrayObject:private] => Array
(
[text] => Sometext
)
)
How do I get standard PHP array from this? I need
Array
(
[text] => Sometext
)
Try this
return json_decode(json_encode(iterator_to_array($user->__next_action)), TRUE);
Quick workaround to get this working.
Well it’s an ArrayObject class so getArrayCopy
should work.