同时变量数组

I've searched through the stack for an answer but it seems that I cannot find a solution for the following code:

$servers = array();
while($row = mysql_fetch_array( $result ))
{
   $servers[] = $row['name'] => array('ip' => $row['ip'],'port' => $row['port'],'info' => $row['info'],'purpose' => $row['purpose']),
}

What I'm trying to achieve is fetch all results but I receive the following error:

syntax error, unexpected '=>' (T_DOUBLE_ARROW).

Making it like this gets only the last item:

while($row = mysql_fetch_array( $result )) {
$servers = array(
    $row['name'] => array('ip' => $row['ip'],'port' => $row['port'],'info' => $row['info'],'purpose' => $row['purpose']),
    );
}

That being said, $servers is in the while loop, thus making it index only the last item. I don't know what causes the unexpected => :/

It looks like you're trying to do this:

$servers = [];
while($row = mysql_fetch_array( $result )) {
   $servers[$row['name']] =  [
       'ip' => $row['ip'],
       'port' => $row['port'],
       'info' => $row['info'],
       'purpose' => $row['purpose']
   ];
}

That gives you a final $servers array, indexed by server name, with an array of details.

Side note: as Jay commented, you really shouldn't be using mysql functions any longer, really encourage you to check out mysqli or PDO functions instead.