Comparing Objects With == And ===

<?php
    class Employee { }    $Bob = new Employee( );
    $Joe = clone $Bob;    print (int)($Bob == $Joe) . "\n";
    print (int)($Joe === $Joe) . "\n";    class Employee {
            public function __construct( ) {
                    $this->myself = $this;
            }
    }    $Bob = new Employee( );
    $Joe = clone $Bob;    print (int)($Bob == $Joe) . "\n";
    print (int)($Bob === $Joe) . "\n";
 
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.