3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class TestClass { public $a; public $b; public $c; public $d; } $inner1 = new TestClass; $inner1->a = 1000; $inner2 = new TestClass; $inner2->a = 1000; $inner3 = new TestClass; $inner3->a = 1001; $o1 = new TestClass; $o1->a = 'abc'; $o1->b = ['a', 'b', 'c']; $o1->c = 123456; $o1->d = $inner1; $o2 = new TestClass; $o2->a = 'abc'; $o2->b = ['a', 'b', 'c']; $o2->c = 123456; $o2->d = $inner2; $o3 = new TestClass; $o3->a = 'abc'; $o3->b = ['a', 'b', 'c']; $o3->c = 123456; $o3->d = $inner3; var_dump([ md5(json_encode($o1)), md5(json_encode($o2)), md5(json_encode($o3)), ]); var_dump($o1 == $o2); var_dump($o1 === $o2);
based on Cm96U
Output for 5.4.0 - 7.2.0
array(3) { [0]=> string(32) "91a910e61d9aa2a0a1d2a9d9c158187b" [1]=> string(32) "91a910e61d9aa2a0a1d2a9d9c158187b" [2]=> string(32) "4083f1724cd56a1f296e35edda523981" } bool(true) bool(false)
Output for 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/hEHHE on line 25
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/hEHHE on line 25
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/hEHHE on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/hEHHE on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/hEHHE on line 5
Process exited with code 255.