How to remove array key name in php

王林
Release: 2023-03-03 22:10:01
Original
3589 people have browsed it

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.

How to remove array key name in php

#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)
Copy after login

(Video tutorial recommendation:Introduction to Programming)

Example:

"Peter","Age"=>"41","Country"=>"USA"); print_r(array_values($a)); ?>
Copy after login

Running result:

Array ( [0] => Peter [1] => 41 [2] => USA )
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!