有没有一种更简单的方法将一个数组分解成一个额外的数组,而不是解包数组,运行分解函数,然后重新打包数组,如下所示。这很好用,我试图找出是否有更简单的方法。
public function getStandardizationTerms()
{
$statement = $this->db->query('SELECT * FROM '.$this->std_table);
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
$new_result = array();
foreach($result as $term) {
// the only purpose of this foreach loop is to turn the exception tables field into an array
$new_result[] = array(
'key' => $term['key'],
'operator' => $term['operator'],
'fragment' => $term['fragment'],
'manufacturer' => $term['manufacturer'],
'is_exception' => $term['is_exception'],
'tables' => explode(",",$term['tables'])
);
}
return $new_result;
}