How to remove array subscript in php

藏色散人
Release: 2023-03-05 06:52:02
Original
4148 people have browsed it

php method to remove array subscripts: first create a PHP sample file; then define an array; finally remove the array key name through the "array_values($arr);" method.

How to remove array subscript in php

Recommendation: "PHP Video Tutorial"

PHP function to remove array key names is:

array_values();

Usage examples are as follows:

<?php
//定义数组
$arr=array(
        "name"=>"zhidao",
        "age"=>"10"
        );
$result = array_values($arr);
 
var_dump($result);
/*array(2) {
  [0]=>
  string(6) "zhidao"
  [1]=>
  string(2) "10"
}*/
?>
Copy after login

The above is the detailed content of How to remove array subscript in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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
Popular Tutorials
More>
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!