I have an array:
array('something' => 'like this', 'something' => 'like this', 'something' => 'like this');
I would like to replace it (quickly as possible, using a simple inline function) t开发者_如何学Pythono be like this:
array(0 => 'like this', 1 => 'like this', 2 => 'like this');
Possible using any built-in php-array functions?
check out array_values
$new_array=array_values($array);
print_r($new_array);
$arr = array(
'something'=>'something',
'something'=>'something'
);
$new_arr = array();
$new_arr = array_values(arr);
print_r($new_arr);
$arr = array(
'something'=>'something',
'something'=>'something'
);
sort($arr);
print_r($arr);
精彩评论