我正在尝试使用其中一个作为数组键提取的列创建数组,但我收到错误消息unexpected T_DOUBLE_ARROW
$students = array();
foreach ($rows as $row) {
$students[$row['first_name']] => $row['last_name'];
}
答案 0 :(得分:1)
=>
应替换为=
$students[$row['first_name']] = $row['last_name'];
答案 1 :(得分:0)
$students = array();
foreach ($rows as $row) {
$students=array($row['first_name'] => $row['last_name']);
}