Home > Article > Backend Development > How to remove array subscript in php
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.
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!