Array operators
Array operators
Example |
name |
Results |
$a + $b |
Joint |
The Union of $a and $b. |
$a = = $b |
Equal |
TRUE if $a and $b have the same key/value pair. |
$a = = = $b |
Congruent |
True if $a and $b have the same key/value pairs and the order and type are the same. |
$a! = $b |
Range |
TRUE if the $a is not equal to $b. |
$a <> $b |
Range |
TRUE if the $a is not equal to $b. |
$a!== $b |
Not congruent |
TRUE if the $a is not all equal to $b. |
The + operator attaches the array element on the right (those elements that have the same key value as the left array element) to the left array, but the duplicate key value is not overwritten.
<?php$a = Array ("A" = "Apple", "b" = "banana"); $b = Array ("A" = "pear", "b" = "Strawberry", "C" and "=" Cherry "); $c = $a + $b; Union of $a and $becho "union of $a and $b: "; Var_dump ($c); $c = $b + $a;//Union of $b and $aecho "Union of $b and $a:
Once executed, this script will display:
U
Union of $a and $b: Array (3) {["a"]=> string (5) "Apple" ["B"]=> string (6) "Banana" ["C"]=> string (6) "Cherry"} Union of $b and $a: Array (3) {["a"]=> string (4) "Pear" ["B"]=> string (Ten) "Strawberry" ["C"]=> string (6) "Cherry " }
The cells in the array are compared when they have the same key name and value.
Example #1 Compare arrays
<?php$a = Array ("Apple", "banana"), $b = Array (1 = "banana", "0" = "apple"), var_dump ($a = = $b); BOOL (true) var_dump ($a = = = $b); BOOL (FALSE)?>
Wei Zesi The impact of the incident on shareholders "Octopus Investment Management": http://licai.daiyuline.com/caijingxinwen/343.html
API short-term good oil price why staged inverted "V" trend "international crude oil price": http://licai.daiyuline.com/yyjg/342.html
Oil prices fell by more than 6% in three days. "International crude oil price": http://licai.daiyuline.com/yyjg/341.html
PHP Array Operators