Home  >  Article  >  Backend Development  >  How to delete the key name of an array in php

How to delete the key name of an array in php

王林
王林Original
2020-07-11 15:48:032733browse

The method to delete the array key name in php is: it can be achieved through the array_values() function. 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 by "1".

How to delete the key name of an array in php

The method to delete the array key name in php is: it can be achieved through the array_values() function.

(Recommended tutorial: php tutorial)

Function introduction:

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

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

Function syntax:

array_values(array)

Parameter introduction:

  • array Required. Specifies an array.

The code is implemented as follows:

'value1','key2'=>'value2','key3'=>'value3');
$arr2 = array_values($arr);
print_r($arr2);
?>

The above is the detailed content of How to delete the key name of an array 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