php array_values() function


  Translation results:

UK['væljʊz] US['væljʊz]

n. Value; concept of value; view of value; criterion; standard; value (plural form of value); standard of value; (currency, stamps etc.) Face value

v. Valuation (the third person singular of value); attach importance to; price...; evaluate

php array_values() functionsyntax

Function: Return all values ​​of the array (non-key names)

Syntax: array_values(array)

Parameters:

Parameter Description
array Required. Specifies an array.

Description: Returns an array containing all key values ​​​​in the given array, but does not retain the key names. The returned array will use numeric keys, starting at 0 and increasing by 1.

php array_values() functionexample

<?php
$a = array("class" => "php中文网","name" => "西门","job" => "讲师");
print_r(array_values($a));
?>

Run instance»

Click the "Run instance" button to view the online instance

Output:

Array ( [0] => php中文网 [1] => 西门 [2] => 讲师 )


<?php
$a = array("class" => "php中文网","name" => "无忌哥哥","job" => "考官");
print_r(array_values($a));
?>

Run Instance»

Click the "Run Instance" button to view the online instance

Output:

Array ( [0] => php中文网 [1] => 无忌哥哥 [2] => 考官 )

Home

Videos

Q&A