Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 用数字键替换关联阵列键的最快方法_Php_Arrays_Key_Associative Array - Fatal编程技术网

Php 用数字键替换关联阵列键的最快方法

Php 用数字键替换关联阵列键的最快方法,php,arrays,key,associative-array,Php,Arrays,Key,Associative Array,我有一个数组: array('something' => 'like this', 'something' => 'like this', 'something' => 'like this'); 我希望将其替换为(尽快,使用简单的内联函数)如下所示: array(0 => 'like this', 1 => 'like this', 2 => 'like this'); 可以使用任何内置php数组函数吗?请退出 对原始数组没有任何影响,这是肯定的 $ne

我有一个数组:

array('something' => 'like this', 'something' => 'like this', 'something' => 'like this');
我希望将其替换为(尽快,使用简单的内联函数)如下所示:

array(0 => 'like this', 1 => 'like this', 2 => 'like this');
可以使用任何内置php数组函数吗?

请退出


对原始数组没有任何影响,这是肯定的
$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);