Home  >  Article  >  Backend Development  >  How to delete array index in php

How to delete array index in php

王林
王林Original
2020-08-01 15:01:133052browse

php method to delete array index: You can use the array_values() function to achieve this. 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. Function syntax: [array_values(array)].

How to delete array index in php

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.

(Recommended tutorial: php graphic tutorial)

Function syntax:

array_values(array)

Code implementation:

 "XL", "color" => "gold");
print_r(array_values($array));
?>

(Video tutorial recommendation: php video tutorial)

Result output:

Array
(
    [0] => XL
    [1] => gold
)

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