Home > Article > Backend Development > How to redefine the keys of the array?
$arr = array( [8]=>123 , [0]=>888 );
Just turn it into array([0]=>123, [1]=>888) without changing the order;
$arr = array( [8]=>123 , [0]=>888 );
Just turn it into array([0]=>123, [1]=>888) without changing the order;
array array_values (array $input)
Return all values in the input array and index them numerically.
<code class="php">$arr = array( [8]=>123 , [0]=>888 ); var_dump(array_values($arr)); //output array( [0]=>123 , [1]=>888 )</code>
From php official manual
http://php.net/manual/zh/book...
array_merge($arr)
Same
Array reordering shuffle()
<code>$a = array('8'=>123,'0'=>888 ); shuffle ($a); var_dump($a); </code>