如何将信息添加到字符串中


How to add information to string

在数据库中,我通过获得了10个lat和lng点

foreach($points as $point){
    ->($point->lng, $point->lat);
}

我有他们所有人的信息,现在我需要将信息添加到

Mapper::map(5, -2) HERE;

所以它应该看起来像

Mapper::map(5, -2)->marker($point->lng, $point->lat)->marker($point->lng, $point->lat)...;

最好的方法是什么。

如果我理解正确:

$map = Mapper::map(5, -2);
foreach($points as $point){
    $map = $map->marker($point->lng, $point->lat);
}
var_dump($map)

但它实际上取决于这个方法返回的结果。在不知道代码在做什么的情况下,不确定这是否适用