The array operators are similar to comparison operators. That is they also use most of the comparison elements in order to compare two or more arrays.

The comparison between arrays is done by on of the following ways:

Example of array operators in PHP

<?php
    $a + $b; // (Union) Union of variables $a and $b
    $a == $b; // (Equality) True if $a and $b have same key/value pairs 
    $a === $b; // (Identity) True if $a and $b have same key/value pairs, in the same order and same types
    $a != $b; // (Inequality) True if $a is not equal $b
    $a <> $b; // (Inequality) True if $a is not equal $b
    $a !== $b; // (Non-identity) True is $a is not identical to $b
?>

 

›› go to examples ››