3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public $dt; function __construct($dt) { $this->dt = $dt; } } $foo = new Foo(new DateTime); $std = new stdClass; $arr = [$foo, $foo, $std, $std, $std]; var_dump(array_unique($arr, SORT_REGULAR));
Output for 7.2.6
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.004749" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.2.3
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.016608" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.2.2
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.026036" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.2.1
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.021289" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.2.0
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.005353" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.1.20
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.004156" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.1.15
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.019756" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.1.14
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.026219" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.1.13
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.019286" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.1.12
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.018649" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.1.11
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.022780" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.1.10
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.012432" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.1.9
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.008829" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.1.8
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.006622" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.1.7
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.006939" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.1.6
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.027569" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.1.5
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.028678" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.1.4
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.047998" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.0.0 - 7.0.27, 7.1.3
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.1.2
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.042234" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.1.1
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.021402" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for 7.1.0
array(2) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.033402" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } }
Output for hhvm-3.18.5, hhvm-3.22.0
array(4) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:44.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [1]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:44.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } [4]=> object(stdClass)#3 (0) { } }
Output for 5.6.0 - 5.6.30, hhvm-3.21.3
array(4) { [0]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [1]=> object(Foo)#1 (1) { ["dt"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2018-03-12 13:26:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } [2]=> object(stdClass)#3 (0) { } [4]=> object(stdClass)#3 (0) { } }