Home>Article>Backend Development> The relationship between keys and values in php arrays

The relationship between keys and values in php arrays

angryTom
angryTom Original
2019-11-02 10:28:50 3444browse

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!

php
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php method of calling class Next article:php method of calling class