Home>Article>Backend Development> The relationship between keys and values in php arrays
The relationship between keys and values in php arrays
● Keys in php arrays can be repeated, but repeated keys The value will be overwritten by the later one.
● Values with different keys in the php array can be repeated.
● Elements in the php array can have keys or no keys.
'a', 'a' => 'b'); var_dump($arr); // 结果 // array(1) { ["a"]=> string(1) "b" } // 数组元素可以有键,也可以没有键 $arr1 = array('a', 'b' => 'b'); var_dump($arr1); // 结果 // array(2) { [0]=> string(1) "a" ["b"]=> string(1) "b" } ?>
For more PHP related knowledge, please visitPHP Chinese website!
The above is the detailed content of The relationship between keys and values in php arrays. For more information, please follow other related articles on the PHP Chinese website!