Toggle navigation
Genres
Frontend (2)
JavaScript (6)
Database (2)
Linux Server (3)
Web Apps (4)
Misc (4)
Search
List
New Tutorials
Last Modified Tutorials
</>
Code examples
code
smiko
backend
php
oop
classes_objects
98comparing1.php
98comparing1.php
<?php class A { public $a; private $b; function __construct($a,$b) { $this->a=$a; $this->b=$b; } } class B { public $a; private $b; function __construct($a,$b) { $this->a=$a; $this->b=$b; } } $obj1=new A('pero',3); $obj2=new A('pero',3); $obj3=new A('pero',4); $obj4=new B('pero',3); if($obj1==$obj2) echo "obj1==obj2 <br/>"; if($obj1!=$obj3) echo "obj1!=obj3 <br/>"; if($obj1!=$obj4) echo "obj1!=obj4 <br/>"; ?>
Reload page
Preview
W3C validation
Edit Code