3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Output for git.master_jit, git.master, rfc.property-hooks
bool(true) bool(true)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
57.96 ms | 401 KiB | 8 Q