���� | ���� | ��� |
---|---|---|
$a + $b | ���� | $a �� $b �����ϡ� |
$a == $b | ��� | ��� $a �� $b ������ͬ�ļ���ֵ����Ϊ TRUE �� |
$a === $b | ȫ�� | ��� $a �� $b ������ͬ�ļ���ֵ�Բ���˳������Ͷ���ͬ��Ϊ TRUE �� |
$a != $b | ���� | ��� $a ������ $b ��Ϊ TRUE �� |
$a <> $b | ���� | ��� $a ������ $b ��Ϊ TRUE �� |
$a !== $b | ��ȫ�� | ��� $a ��ȫ���� $b ��Ϊ TRUE �� |
+ ��������ұߵ�����Ԫ�ظ��ӵ���ߵ�������棬���������ж��еļ�������ֻ����������еģ��ұߵı����ԡ�
<?php
$a = array("a" => "apple", "b" => "banana");
$b = array("a" => "pear", "b" => "strawberry", "c" => "cherry");
$c = $a + $b; // Union of $a and $b
echo "Union of \$a and \$b: \n";
var_dump($c);
$c = $b + $a; // Union of $b and $a
echo "Union of \$b and \$a: \n";
var_dump($c);
$a += $b; // Union of $a += $b is $a and $b
echo "Union of \$a += \$b: \n";
var_dump($a);
?>
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(10) "strawberry" ["c"]=> string(6) "cherry" } Union of $a += $b: array(3) { 'a' => string(5) "apple" 'b' => string(6) "banana" 'c' => string(6) "cherry" }
�����еĵ�Ԫ���������ͬ�ļ�����ֵ��Ƚ�ʱ��ȡ�
Example #1 �Ƚ�����
<?php
$a = array("apple", "banana");
$b = array(1 => "banana", "0" => "apple");
var_dump($a == $b); // bool(true)
var_dump($a === $b); // bool(false)
?>