<?php
Require_once ' person.php ';
Header ("Content-type:text/html;charset=utf-8");
$person 001=new person ("Wuxifu", 110);
$person 002=new person ("Wuxifu", 110);
$person 003= $person 001;
//congruent (= = =) To determine the first data type to be the same, the data type is False
(1) If the object is the same data type (true if the same object is false)
echo "<br/>person001 and person002 are not the same object case, not congruent *************<br/>";
if ($person 001=== $person 002)
{
echo "person001===person002 is the same object";
}else
{
echo "person001!==person002 is not the same object";
}
echo "<br/>person001 and person003 are the same object case, congruent **************<br/>";
if ($person 001=== $person 003)
{
echo "person001===person003 is the same object";
}else
{
echo "person001!==person003 is not the same object";
}
//(2) is the same data type, if it is an array (true if the content is false)
$array =array (110,120,130);
$array 2=array (110,120,130);
$array 3= $array;
echo "<br/><br/>array and array2 not the same array, but the same content, congruent *************<br/>";
if ($array = = = $array 2)
{
echo "Array===array2";
}else
{
echo "Array!==array2";
}
echo "<br/>array and Array3 not the same array, but the same content, congruent ************************<br/>";
if ($array = = = $array 3)
{
echo "Array===array3";
}else
{
echo "Array!==array3";
}
echo "<br/>array and Array3 not the same array, the content is not the same, not congruent ***********************<br/>";
$array 3[0]=0;
if ($array = = = $array 3)
{
echo "Array===array3";
}else
{
echo "Array!==array3";
}
echo "<br/>";
//(3) is the same data type, if it is four scalar types (boolean,integer,float,string), the same value is true no is false
echo "<br/> is the same data type, if it is four scalar types (boolean,integer,float,string), the same value is true no is false<br/>";
$nums = 110;
$nums 2=120;
$nums 3=110;
if ($nums = = = $nums 2)
{
echo "Nums===nums2 value";
}else
{
echo "Nums!==nums2 value is not the same";
}
echo "<br/>";
if ($nums = = = $nums 3)
{
echo "Nums===nums3 value";
}else
{
echo "Nums!==nums3 value is not the same";
}
//(4) is not the same data type, or false
echo "<br/><br/> is not the same type of false not congruent ********************************<br/>";
if ($nums ===true)
{
echo "Nums===true";
}else
{
echo "Nums!==true";
}
echo "<br/>";
if ($person 001===true)
{
echo "Person001===true";
}else
{
echo "Person001!==true";
}
?>
*************************************************************
<?php
Require_once ' person.php ';
Header ("Content-type:text/html;charset=utf-8");
$person 001=new person ("Wuxifu", 110);
$person 002=new person ("Wuxifu", 110);
$person 003= $person 001;
//wait (= =) to determine the data type first, not the same, if one side of the equal sign is a Boolean type, the other side is converted to a Boolean type, otherwise the right side of the equal sign will be cast to the left data type
(1) is the same data type, if the object (as long as the contents of the two objects is true no is false)
echo "<br/>person001 and person002 are not the same object case, but the content is equal to *************<br/>";
if ($person 001== $person 002)
{
echo "person001==person002 content";
}else
{
echo "person001!=person002 content is not the same";
}
echo "<br/>person001 and person003 are the same object in the case (content same), etc. **************<br/>";
if ($person 001== $person 003)
{
echo "person001==person003 is the same object";
}else
{
echo "person001!=person003 is not the same object";
}
//(2) is the same data type, if it is an array (true if the content is false)
$array =array (110,120,130);
$array 2=array (110,120,130);
$array 3= $array;
echo "<br/><br/>array and array2 not the same array, but the same content, such as *************<br/>";
if ($array = = $array 2)
{
echo "Array==array2";
}else
{
echo "Array!=array2";
}
echo "<br/>array and Array3 not the same array, but the same content, such as ************************<br/>";
if ($array = = $array 3)
{
echo "Array==array3";
}else
{
echo "Array!=array3";
}
echo "<br/>array and Array3 not the same array, the content is not the same, unequal ***********************<br/>";
$array 3[0]=0;
if ($array = = $array 3)
{
echo "Array===array3";
}else
{
echo "Array!==array3";
}
echo "<br/>";
//(3) is the same data type, if it is four scalar types (boolean,integer,float,string), the same value is true no is false
echo "<br/> is the same data type, if it is four scalar types (boolean,integer,float,string), the same value is true no is false<br/>";
$nums = 110;
$nums 2=120;
$nums 3=110;
if ($nums = = $nums 2)
{
echo "Nums==nums2 value";
}else
{
echo "NUMS!==NUMS2 value is not the same";
}
echo "<br/>";
if ($nums = = $nums 3)
{
echo "Nums==nums3 value";
}else
{
echo "Nums!=nums3 value is not the same";
}
//(4) is not the same data type, if there is a Boolean value on one side of the equal sign, the other side is converted to a Boolean type, otherwise the right side of the equal sign will be turned to the data type to the left of the equals sign
echo "<br/><br/> is not the same data type, if there is a Boolean value on one side of the equal sign, the other side is converted to a Boolean type, otherwise the right side of the equal sign will be turned to the data type on the left of the equals sign **************** <br/> ";
if ($nums ==true)
{
echo "Nums==true";
}else
{
echo "Nums!=true";
}
echo "<br/>";
if ($person 001==true)
{
echo "Person001==true";
}else
{
echo "Person001!=true";
}
echo "<br/>";
if (true== $nums)
{
echo "True==nums";
}else
{
echo "True!=nums";
}
echo "<br/>";
if (true== $person 001)
{
echo "true==person001";
}else
{
echo "true!=person001";
}
echo "<br/>";
if ($array = = $person 001)
{
echo "array==person001";
}else
{
echo "array!=person001";
}
echo "<br/>";
if ($array ==true)
{
echo "Array==true";
}else
{
echo "Array!=true";
}
?>