我需要将从 MySQL 接收到的值添加到数组 (PHP) 中。这是我所拥有的:
$players = array();
while ($homePlayerRow = mysql_fetch_array($homePlayerResult)) {
$players[] = $homePlayerRow['player_id'];
}
这是唯一的方法吗?
另外,以下是否更快/更好?
$players = array();
while ($homePlayerRow = mysql_fetch_array($homePlayerResult)) {
array_push($players, $homePlayerRow['player_id']);
}