What are the array operators in PHP
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!