#PHP How to remove Array key values?
In PHP, you can use the "array_keys()" function to remove the array key values. This function will return some or all of the key names in the array. The syntax is "array_keys(array)", Its parameter array represents the array whose key values are to be removed. When using it, you only need to pass the array into the array.
Code example
<?php $array = array(0 => 100, "color" => "red"); print_r(array_keys($array)); $array = array("blue", "red", "green", "blue", "blue"); print_r(array_keys($array, "blue")); $array = array("color" => array("blue", "red", "green"), "size" => array("small", "medium", "large")); print_r(array_keys($array)); ?>
Output:
Array ( [0] => 0 [1] => color ) Array ( [0] => 0 [1] => 3 [2] => 4 ) Array ( [0] => color [1] => size )
Recommended tutorial: "PHP Tutorial》
The above is the detailed content of How to remove Array key value in PHP?. For more information, please follow other related articles on the PHP Chinese website!