<?php
include('compareobject.php');
class class1
{
private $x;
private $y;
function __set($propiedad,$valor)
{
$this->$propiedad=$valor;
}
function __get($propiedad)
{
return $this->$propiedad;
}
}
$object1=new class1();
$object1->x=10;
$object1->y=20;
$object2=new class1();
$object2->x=10;
$object2->y=20;
$object3=new class1();
$object3->x=10;
$object3->y=10;
if(compareobject::compareobjects($object1,$object2))
{
echo "The OBJECT 1: \n";
print_r($object1);
echo "\nIs Equal to \n"; //print 1
echo "The OBJECT 2: \n";
print_r($object2);
echo "\n";
echo "\n";
echo "\n";
}
if(!compareobject::compareobjects($object1,$object3))
{
echo "The OBJECT 1: \n";
print_r($object1);
echo "\nIs not equal to \n"; //print 1
echo "The OBJECT 3: \n";
print_r($object3);
}
?>
|