取出数组中的值并重置索引
<?php
$arr = [ 4 => 10, 1 => 22, 9 => 55, 0=>255];
$res = array_values($arr);
printf('<pre>%s</pre>',print_r($res,true));
<?php
$arr1 = [ 4 => 10, 1 => 22, 9 => 55, 0=>255];
$res1 = [];
foreach($arr1 as $k => $v)
{
array_push($res1,$v);
}
echo '<pre>';
print_r($res1);
<?php
$arr2 = [ 4 => 10, 1 => 22, 9 => 55, 0=>255];
$res2[] = array_shift($arr2);
$res2[] .= array_shift($arr2,);
$res2[] .= array_shift($arr2,);
$res2[] .= array_shift($arr2,);
echo '<pre>';
print_r($res2);