重置PHP数组索引
我有一个PHP数组,看起来像这样:
[3] => Hello [7] => Moo [45] => America
什么PHPfunction使这个?
[0] => Hello [1] => Moo [2] => America
array_values()
函数[ 文档 ]做到这一点:
$a = array( 3 => "Hello", 7 => "Moo", 45 => "America" ); $b = array_values($a); print_r($b);
Array ( [0] => Hello [1] => Moo [2] => America )