in a document of MongoDB, i have a key/value such that value is an association array (inserted using php); how can iterate throuth this array
array(4) {
["_id"]=>
object(MongoId)#8 (0) {
}
["tabid"]=>
string(6) "123456"
["type"]=>
string(6) "design"
["data"]=>
array(2) {
["article"]=>
string(57) "Bla bla"
["comts"]=>
string(57) "Bla2 bla2"
}
}
i did i var_dump to get this.
here is how what i did, but its not working
foreach($arr['data'] as $k => $v){
$txt+=sprintf("%s<br><i>%s</i><br><br>",$k,(string)$v); }
any help please?
why
$txt+?+is operator for addition in PHP.$txtwill be equal to a number in the end.For concatenation two strings use
.