2017-09-23 69 views

回答

0

沒什麼特別的事:

$this->points = array_map(function($i) { return $i->getRoutePoint(); }, $addresses); 

但是,使用foreach更快,你不需要使用$points變量:

$this->points = []; 
foreach($addresses as $address) { 
    $this->points[] = $address->getRoutePoint(); 
} 
相關問題