Como re-indexar os valores de uma matriz em PHP?

Array ( [id] => 3 [user_id] => 1 [clan_id] => 1 [date] => 2009-09-24 09:02:05 [skill1rank] => 1 [skill1lvl] => 2376 [skill1xp] => 1804229942 [skill2rank] => 53 [skill2lvl] => 99 [skill2xp] => 120510105 [skill3rank] => 5526 [skill3lvl] => 99 [skill3xp] => 21581237 [skill4rank] => 622 ... [skill21xp] => 38458116 [skill22rank] => 184 [skill22lvl] => 99 [skill22xp] => 22217059 [skill23rank] => 5267 [skill23lvl] => 99 [skill23xp] => 13396733 [skill24rank] => 101 [skill24lvl] => 99 [skill24xp] => 15724235 [skill25rank] => 903 [skill25lvl] => 99 [skill25xp] => 13373505 ) 

Quero mudar o nome para as chaves para $array[0] , $array[1] , etc.

Como eu faria isso?


Obrigado, Silentghost. Trabalhou bem. ūüôā

array_values

Use array_values:

 array_values( [id] => 3 [user_id] => 1 [clan_id] => 1 [date] => 2009-09-24 09:02:05 [skill1rank] => 1 [skill1lvl] => 2376 [skill1xp] => 1804229942 [skill2rank] => 53 [skill2lvl] => 99 [skill2xp] => 120510105 [skill3rank] => 5526 [skill3lvl] => 99 [skill3xp] => 21581237 [skill4rank] => 622 ... [skill21xp] => 38458116 [skill22rank] => 184 [skill22lvl] => 99 [skill22xp] => 22217059 [skill23rank] => 5267 [skill23lvl] => 99 [skill23xp] => 13396733 [skill24rank] => 101 [skill24lvl] => 99 [skill24xp] => 15724235 [skill25rank] => 903 [skill25lvl] => 99 [skill25xp] => 13373505 ); 

Aqui está a minha solução:

 $array = array( "id" => 3, "user_id" => 1, "clan_id" => 1, "date" => "2009-09-24 09:02:05", "skill1rank" => 1, "skill1lvl" => 2376, "skill1xp" => 1804229942, "skill2rank" => 53, "skill2lvl" => 99, "skill2xp" => 120510105, "skill3rank" => 5526, "skill3lvl" => 99, "skill3xp" => 21581237, "skill4rank" => 622, ); $newArray = array(); foreach($array as $key => $value) { $newArray[] = $value; }