Home > Article > Backend Development > How to remove array key name in php
How to remove array key names in php: You can use the array_values() function to remove array key names. The array_values() function returns an array containing all the values in the array. The returned array will use numeric keys, starting from 0 and increasing from 1.
#You can delete key names through the array_values() function.
(Recommended tutorial: php graphic tutorial)
array_values() function returns an array containing all the values in the array.
Note: The returned array will use numeric keys, starting from 0 and increasing by 1.
Grammar:
array_values(array)
(Video tutorial recommendation: Introduction to Programming)
Example:
<?php $a=array("Name"=>"Peter","Age"=>"41","Country"=>"USA"); print_r(array_values($a)); ?>
Running result:
Array ( [0] => Peter [1] => 41 [2] => USA )
The above is the detailed content of How to remove array key name in php. For more information, please follow other related articles on the PHP Chinese website!