3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php if (!defined('PHP_INT_MAX')) { $min = -1; do { $last = $min; } while(0 > $min <<= 1); define('PHP_INT_MIN', $last); define('PHP_INT_MAX', ~$last); } class Object { var $foo, $id; function Object() { static $counter = 0; if (PHP_INT_MAX === $this->id = ++$counter) { $counter = PHP_INT_MIN; } } } $a = new Object; $b = new Object; $a->foo = 1; $b->foo = 1; var_dump($a == $b, $a === $b);
based on pBrfd
Output for 7.0.0 - 7.1.0
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Object has a deprecated constructor in /in/rT00G on line 13 bool(false) bool(false)
Output for 4.3.0 - 4.4.9, 5.1.3 - 5.6.28
bool(false) bool(false)
Output for 5.0.0 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/rT00G on line 15 bool(false) bool(false)