Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the array operators in PHP

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "what are the array operators in PHP", which is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn what array operators are in PHP.

Array operator

/ * * commonly used array operator: * +: merge the array, if the key name is the same, only show the key value pair of the left array * = =: compare whether the key name of the array and the corresponding key value are the same, if the same returns true, otherwise return false * = =: compare the key name with the corresponding key value and key type And the order should also be the same *! =: compare whether the key name and the corresponding key value of the array are different *! = =: compare whether the key name of the array and the corresponding key value and key value type are different, or the order is different *: and! = effect is the same * / $arr1 = [1, 2, 3] $arr2 = ['arrSum2,' baked,'c']; $arr3 = ['username'= >' Zhang San', 'age'= > 12]; $arr4 = [10 = > 10,11 = > 11]; $arrSum1 = $arr1 + $arr2; / / if the key name is the same, only the key-value pair of the left array $arrSum2 = $arr1 + $arr3; / / + is independent of whether the array is an indexed array or an associative array $arrSum3 = $arr1 + $arr3 + $arr4 / / if the key names of the following array and the previous array are duplicated and will not be overwritten, the corresponding key values of the previous array print_r ($arrSum1) will be displayed; / / Array ([0] = > 1 [1] = > 2 [2] = > 3) print_r ($arrSum2); / / Array ([0] = > 1 [1] = > 2 [2] = > 3 [username] = > Zhang San [age] = > 12) print_r ($arrSum3) / / Array ([0] = > 1 [1] = > 2 [2] = > 3 [username] = > Zhang San [age] = > 12 [10] = > 10 [11] = > 11) $arr5 = ['1bread = > 1,' baked = > 2, 'caged = > 3]; $arr6 = [' baked = > 2,'1' = > 1, 'cached = > 3]; $arr7 = [1 = > 1,' baked = > 2, 'cased = > 3]; var_dump ($arr5 = = $arr6); / / bool (true) var_dump ($arr5 = = $arr6) / / bool (false) var_dump ($arr5 = $arr7); / / bool (true) var_dump ($arr5! = $arr6); / / bool (false) var_dump ($arr5! = = $arr6); / / bool (true) above is all the content of the article "what are the array operators in PHP"? thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report