Home  >  Article  >  Backend Development  >  How to remove array subscript in php

How to remove array subscript in php

藏色散人
藏色散人Original
2020-08-24 09:48:314186browse

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"
}*/
?>

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!

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