PHP array
PHP array_values
PHP array_values is used to query the element values of the array. Put an array into array_values for processing. The system will create a new number array index and form a new array.
PHP array_values syntax example
array array_values (array $array input to be processed);
array_values can only handle PHP arrays, not ordinary strings.
PHP array_values implementation example
<?php
$Arr=array( "A1" => "A" , "A2" => "B" , "A3" => "C" );
print_r(array_values($Arr)); // 輸出結果 Array ( [0] => A [1] => B [2] => C )
?>
$Arr=array( "A1" => "A" , "A2" => "B" , "A3" => "C" );
print_r(array_values($Arr)); // 輸出結果 Array ( [0] => A [1] => B [2] => C )
?>
At the beginning of the example, prepare a $Arr with a total of four elements, and use array_values to renumber and arrange the array elements. It can be easily seen from the example that all the keys in the original array are replaced by digital key values. Lost.
 
 
Post a Comment
0 Comments