<?php
class A { public $a; }
class B extends A { public $b; }
$a = new B(); $a->a = 0; $a->b = 1;
$b = new B(); $b->a = 1; $b->b = 0;
// This compare walks the properties_table in both objects directly,
// resulting in ->a being compared first.
//
// Ref: https://github.com/php/php-src/blob/b151e17bdfca573e0205cc90dc710f89d77f03cf/Zend/zend_object_handlers.c#L1517
var_dump($a < $b);
// print_r() (or several other potential actions) forces the properties HashTable to be materialized,
// It's not the output of this that matters, so ignore it.
print_r($a, true);
// Now that one of the objects has a materialized HashTable,
// we materialize the other and walk that instead.
// However, ordering of properties in properties_info
// is not (necessarily) the same as in the property slots.
//
// Ref: https://github.com/php/php-src/blob/b151e17bdfca573e0205cc90dc710f89d77f03cf/Zend/zend_object_handlers.c#L1569
// Ref: https://github.com/php/php-src/blob/b151e17bdfca573e0205cc90dc710f89d77f03cf/Zend/zend_object_handlers.c#L70
var_dump($a < $b);