0

我正在尝试使用作为数组键提取的列之一创建一个数组,但我收到了错误消息unexpected T_DOUBLE_ARROW

$students = array();
foreach ($rows as $row) { 
    $students[$row['first_name']] => $row['last_name'];
}
4

2 回答 2

1

=>应该替换为=

$students[$row['first_name']] = $row['last_name'];
于 2013-04-17T19:11:05.423 回答
0
$students = array();
foreach ($rows as $row) { 
    $students=array($row['first_name'] => $row['last_name']);
}
于 2013-04-17T19:57:23.733 回答