php array_values 返回数组的所有值详解及实例
phparray_values
phparray_values函数用于返回数组中所有的值,注意该函数将为新数组建立数组索引,原来的文字索引将不存在。本文章向大家讲解array_values函数的基本语法及使用实例。
array_values返回数组中所有的值
基本语法:
arrayarray_values(array$input)
array_values()返回input数组中所有的值并给其建立数字索引。
参数介绍:
参数
描述
input
必需。规定数组。
返回值:
返回含所有值的索引数组。
注意:
返回的新数组的所有将使用数字索引,从0开始。
实例:
<?php $array=array( "php"=>"phpcode", "html"=>"htmlcode", "css"=>"csscode", "js"=>"jscode", ); print_r(array_values($array)); ?>
运行结果:
Array([0]=>phpcode[1]=>htmlcode[2]=>csscode[3]=>jscode)
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!