Ben şöyle bir dizi almak gerekir ...
array( 11 => "fistVal", 19 => "secondVal", 120=> "thirdVal", 200 =>"fourthVal");
ve onu dönüştürmek ...
array( 0 => "fistVal", 1 => "secondVal", 2=> "thirdVal", 3 =>"fourthVal");
Bu ben ile geldi budur -
function compressArray($array){
if(count($array){
$counter = 0;
$compressedArray = array();
foreach($array as $cur){
$compressedArray[$count] = $cur;
$count++;
}
return $compressedArray;
} else {
return false;
}
}
Bunu yapmak için php veya düzgün hileler herhangi yerleşik işlevselliği varsa ben sadece merak ediyorum.