I
I
ignat072019-02-21 14:05:46
PHP
ignat07, 2019-02-21 14:05:46

Get values ​​from bson array object?

I have an array that has a values ​​field that has this structure

MongoDB\Model\BSONArray Object ( [storage:ArrayObject:private] => Array ( [0] => MongoDB\Model\BSONDocument Object ( [storage:ArrayObject:private] => Array ( [name] => %1548142370673% [value] => 321312 ) ) )

How can I get Php's key(name) and its value (321312) ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-02-21
@ignat07

Try like this:

$name = $array[0]["name"];
$value = $array[0]["value"];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question