"Peter","Age"=>"41");array_values($a)]."/> "Peter","Age"=>"41");array_values($a)].">

Home>Article>Backend Development> How to remove array key name in php

How to remove array key name in php

王林
王林 Original
2020-07-29 13:47:15 3199browse

php method to remove array key names: You can use the array_values() function, which returns an array containing all the values in the array. The specific usage method is: [$a=array("Name"=>"Peter","Age"=>"41");array_values($a)].

How to remove array key name in php

array_values() function returns an array containing all the values in the array.

(Recommended tutorial:php tutorial)

Note: The returned array will use numerical keys, starting from 0 and increasing by 1.

Function syntax:

array_values(array)

Parameter description:

  • array Required. Specifies an array.

Code implementation:

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

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!

Statement:
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