3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = (object) array(); $b = (object) array(); function object_handle($obj) { static $mask = null; if (null === $mask) { $o = (object) array(); $h = hexdec(substr(spl_object_hash($o), 0, 16)); ob_start(); debug_zval_dump($o); $mask = ob_get_clean(); $mask = $h ^ (int) substr($mask, 1 + strpos($mask, '#')); } return hexdec(substr(spl_object_hash($obj), 0, 16)) ^ $mask; } echo object_handle((object) array()), "\n"; echo object_handle($b), "\n"; echo object_handle($a), "\n";
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
3 2 1
Output for hhvm-3.10.0 - 3.12.0
4 4 4
Output for 5.2.17
646651124742252382 7351829356887748315 -298334234034437034
Output for 5.2.15 - 5.2.16
1369030309227628548 -109289055808984719 1321835310295642116
Output for 5.2.14
6315953780813613787 61697087501865376 638468653842000337
Output for 5.2.13
-2938194988057590050 3387604448617530194 5887809162812771290
Output for 5.2.12
8321179991781576708 -8235346868548475566 -7335669956814800925
Output for 5.2.9, 5.2.11
4099526925510424580 -8170153583788030769 -6334963499803938540
Output for 5.2.10
4186664461334715337 -6648757183844304321 -8811859113282557377
Output for 5.2.7 - 5.2.8
6816473773669120949 867862158651104131 -9035402648764004961
Output for 5.2.6
-8973761843691766693 5758618433556232196 6305326977145552900
Output for 5.2.5
4670471857457313796 -1965287668951016829 864663638041487364
Output for 5.2.4
3987151376275992580 6500663968219777028 -5416804596981558087
Output for 5.2.3
-3186625279786954653 6343526618684876334 -5660007485187151773
Output for 5.2.2
-8958158233037149096 -1664683274140624758 7843222623509573636
Output for 5.2.1
7182752893935687684 6917612909000331268 -624077644387573777
Output for 5.2.0
-5036749041073935112 -2718614328690581033 -7026829652224540073
Output for 5.0.0 - 5.1.6
Fatal error: Call to undefined function spl_object_hash() in /in/2h5QE on line 12
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: spl_object_hash() in /in/2h5QE on line 12
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: spl_object_hash() in /in/2h5QE on line 12
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: spl_object_hash() in /in/2h5QE on line 12