3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Singleton{ private static $instance; private function __construct(){} private function __clone() {} public static function instance() { if (is_null(self::$instance)){ self::$instance = new static; } return self::$instance; } } $obj1 = Singleton::instance(); $obj2 = Singleton::instance(); var_dump(spl_object_hash($obj1), spl_object_hash($obj2)); $closure = function(){ return clone self::$instance; }; $cloner = $closure->bindTo($obj1, 'Singleton'); $obj3 = $cloner(); var_dump(spl_object_hash($obj3));
Output for 7.1.0
string(32) "00000000513453f0000000007cb1ff10" string(32) "00000000513453f0000000007cb1ff10" string(32) "00000000513453f5000000007cb1ff10"
Output for 7.0.14
string(32) "000000000b65e2b000000000168ed1d1" string(32) "000000000b65e2b000000000168ed1d1" string(32) "000000000b65e2b500000000168ed1d1"
Output for 7.0.6
string(32) "000000007c0762350000000061e886bb" string(32) "000000007c0762350000000061e886bb" string(32) "000000007c0762300000000061e886bb"
Output for 7.0.5
string(32) "000000002c7eda9100000000128eccd9" string(32) "000000002c7eda9100000000128eccd9" string(32) "000000002c7eda9400000000128eccd9"
Output for 7.0.4
string(32) "000000003dab3ebd0000000065165ade" string(32) "000000003dab3ebd0000000065165ade" string(32) "000000003dab3eb80000000065165ade"
Output for 7.0.3
string(32) "000000007e44f536000000001aad823b" string(32) "000000007e44f536000000001aad823b" string(32) "000000007e44f533000000001aad823b"
Output for 7.0.2
string(32) "000000001bdbd10b00000000723193c9" string(32) "000000001bdbd10b00000000723193c9" string(32) "000000001bdbd10e00000000723193c9"
Output for 7.0.1
string(32) "00000000075b68ac000000002ae1833a" string(32) "00000000075b68ac000000002ae1833a" string(32) "00000000075b68a9000000002ae1833a"
Output for 7.0.0
string(32) "0000000054b85e81000000007c5c674d" string(32) "0000000054b85e81000000007c5c674d" string(32) "0000000054b85e84000000007c5c674d"
Output for hhvm-3.12.0
string(32) "0000000000000000beff87212387a003" string(32) "0000000000000000beff87212387a003" string(32) "0000000000000000beff87212387a063"
Output for hhvm-3.10.0
string(32) "000000000000000017f390261a5b7c44" string(32) "000000000000000017f390261a5b7c44" string(32) "000000000000000017f390261a5b7c84"
Output for 5.6.28
string(32) "000000007d7cb821000000005b996b77" string(32) "000000007d7cb821000000005b996b77" string(32) "000000007d7cb824000000005b996b77"
Output for 5.6.21
string(32) "000000000167f9870000000032caac83" string(32) "000000000167f9870000000032caac83" string(32) "000000000167f9820000000032caac83"
Output for 5.6.20
string(32) "0000000047ed525c000000006109cfe7" string(32) "0000000047ed525c000000006109cfe7" string(32) "0000000047ed5259000000006109cfe7"
Output for 5.6.19
string(32) "0000000076e17c38000000004b0dc98f" string(32) "0000000076e17c38000000004b0dc98f" string(32) "0000000076e17c3d000000004b0dc98f"
Output for 5.6.18
string(32) "0000000000a616ce000000003174e10c" string(32) "0000000000a616ce000000003174e10c" string(32) "0000000000a616cb000000003174e10c"
Output for 5.6.17
string(32) "000000002bc13560000000007f40661f" string(32) "000000002bc13560000000007f40661f" string(32) "000000002bc13565000000007f40661f"
Output for 5.6.16
string(32) "0000000026d8c6a00000000069ee37b0" string(32) "0000000026d8c6a00000000069ee37b0" string(32) "0000000026d8c6a50000000069ee37b0"
Output for 5.6.15
string(32) "000000004a0c97f40000000060dfc5ee" string(32) "000000004a0c97f40000000060dfc5ee" string(32) "000000004a0c97f10000000060dfc5ee"
Output for 5.6.14
string(32) "000000001d2691790000000031230e96" string(32) "000000001d2691790000000031230e96" string(32) "000000001d26917c0000000031230e96"
Output for 5.6.13
string(32) "0000000054b83fce0000000041e9a022" string(32) "0000000054b83fce0000000041e9a022" string(32) "0000000054b83fcb0000000041e9a022"
Output for 5.6.12
string(32) "000000003ca6f0e70000000059786570" string(32) "000000003ca6f0e70000000059786570" string(32) "000000003ca6f0e20000000059786570"
Output for 5.6.11
string(32) "0000000064cfd5eb00000000115fcaf1" string(32) "0000000064cfd5eb00000000115fcaf1" string(32) "0000000064cfd5ee00000000115fcaf1"
Output for 5.6.10
string(32) "0000000042eae3e80000000063f2fbec" string(32) "0000000042eae3e80000000063f2fbec" string(32) "0000000042eae3ed0000000063f2fbec"
Output for 5.6.9
string(32) "000000006c14224700000000086b190b" string(32) "000000006c14224700000000086b190b" string(32) "000000006c14224200000000086b190b"
Output for 5.6.8
string(32) "000000007c0055e0000000004a415eda" string(32) "000000007c0055e0000000004a415eda" string(32) "000000007c0055e5000000004a415eda"
Output for 5.6.7
string(32) "000000003a80869e000000007b2d5b5e" string(32) "000000003a80869e000000007b2d5b5e" string(32) "000000003a80869b000000007b2d5b5e"
Output for 5.5.35
string(32) "0000000054e146ef00000000623203e7" string(32) "0000000054e146ef00000000623203e7" string(32) "0000000054e146ea00000000623203e7"
Output for 5.5.34
string(32) "0000000079ca00b20000000072af0043" string(32) "0000000079ca00b20000000072af0043" string(32) "0000000079ca00b70000000072af0043"
Output for 5.5.33
string(32) "0000000055356b11000000007fcbbbec" string(32) "0000000055356b11000000007fcbbbec" string(32) "0000000055356b14000000007fcbbbec"
Output for 5.5.32
string(32) "000000004088fbc100000000112f63fe" string(32) "000000004088fbc100000000112f63fe" string(32) "000000004088fbc400000000112f63fe"
Output for 5.5.31
string(32) "000000006d2f87a80000000068b80d0d" string(32) "000000006d2f87a80000000068b80d0d" string(32) "000000006d2f87ad0000000068b80d0d"
Output for 5.5.30
string(32) "0000000032636104000000001ef41256" string(32) "0000000032636104000000001ef41256" string(32) "0000000032636101000000001ef41256"
Output for 5.5.29
string(32) "000000006f83c8ed000000003e7be3c5" string(32) "000000006f83c8ed000000003e7be3c5" string(32) "000000006f83c8e8000000003e7be3c5"
Output for 5.5.28
string(32) "00000000290a21ae0000000079f9edbe" string(32) "00000000290a21ae0000000079f9edbe" string(32) "00000000290a21ab0000000079f9edbe"
Output for 5.5.27
string(32) "0000000016afda9d000000005225644a" string(32) "0000000016afda9d000000005225644a" string(32) "0000000016afda98000000005225644a"
Output for 5.5.26
string(32) "00000000352a184100000000159e58ac" string(32) "00000000352a184100000000159e58ac" string(32) "00000000352a184400000000159e58ac"
Output for 5.5.25
string(32) "0000000051c4d9c90000000034e71bf8" string(32) "0000000051c4d9c90000000034e71bf8" string(32) "0000000051c4d9cc0000000034e71bf8"
Output for 5.5.24
string(32) "000000003ffe0cee000000005878651e" string(32) "000000003ffe0cee000000005878651e" string(32) "000000003ffe0ceb000000005878651e"
Output for 5.4.45
string(32) "0000000026ba1283000000000d5b89b5" string(32) "0000000026ba1283000000000d5b89b5" string(32) "0000000026ba1286000000000d5b89b5"
Output for 5.4.44
string(32) "000000006d31ae010000000019f7800b" string(32) "000000006d31ae010000000019f7800b" string(32) "000000006d31ae040000000019f7800b"
Output for 5.4.43
string(32) "0000000049c3f68200000000081bb80f" string(32) "0000000049c3f68200000000081bb80f" string(32) "0000000049c3f68700000000081bb80f"
Output for 5.4.42
string(32) "00000000578cdc2d00000000071b6573" string(32) "00000000578cdc2d00000000071b6573" string(32) "00000000578cdc2800000000071b6573"
Output for 5.4.41
string(32) "000000003d5d24cc000000005813e10a" string(32) "000000003d5d24cc000000005813e10a" string(32) "000000003d5d24c9000000005813e10a"
Output for 5.4.40
string(32) "00000000331fc01d00000000534778d0" string(32) "00000000331fc01d00000000534778d0" string(32) "00000000331fc01800000000534778d0"
Output for 5.4.39
string(32) "0000000036b27d69000000007b1b267b" string(32) "0000000036b27d69000000007b1b267b" string(32) "0000000036b27d6c000000007b1b267b"
Output for 5.4.38
string(32) "000000005379789f0000000040fa8266" string(32) "000000005379789f0000000040fa8266" string(32) "000000005379789a0000000040fa8266"
Output for 5.4.37
string(32) "0000000036a0c2c400000000424ba90a" string(32) "0000000036a0c2c400000000424ba90a" string(32) "0000000036a0c2c100000000424ba90a"
Output for 5.4.36
string(32) "000000005cf62f9a000000003f237c82" string(32) "000000005cf62f9a000000003f237c82" string(32) "000000005cf62f9f000000003f237c82"
Output for 5.4.35
string(32) "000000002036e4910000000053d81c79" string(32) "000000002036e4910000000053d81c79" string(32) "000000002036e4940000000053d81c79"
Output for 5.4.34
string(32) "000000007e2c3b680000000059629c03" string(32) "000000007e2c3b680000000059629c03" string(32) "000000007e2c3b6d0000000059629c03"
Output for 5.4.32
string(32) "000000001dd28d4a000000004c23ee0e" string(32) "000000001dd28d4a000000004c23ee0e" string(32) "000000001dd28d4f000000004c23ee0e"
Output for 5.4.31
string(32) "000000003bc258fb000000003c80782b" string(32) "000000003bc258fb000000003c80782b" string(32) "000000003bc258fe000000003c80782b"
Output for 5.4.30
string(32) "0000000014731dbe0000000023537e2b" string(32) "0000000014731dbe0000000023537e2b" string(32) "0000000014731dbb0000000023537e2b"
Output for 5.4.29
string(32) "0000000005877ae0000000006386d16d" string(32) "0000000005877ae0000000006386d16d" string(32) "0000000005877ae5000000006386d16d"
Output for 5.4.28
string(32) "00000000586f24b600000000200c6134" string(32) "00000000586f24b600000000200c6134" string(32) "00000000586f24b300000000200c6134"
Output for 5.4.27
string(32) "000000002232e20c000000002377624c" string(32) "000000002232e20c000000002377624c" string(32) "000000002232e209000000002377624c"
Output for 5.4.26
string(32) "000000003ef16579000000003710bae1" string(32) "000000003ef16579000000003710bae1" string(32) "000000003ef1657c000000003710bae1"
Output for 5.4.25
string(32) "000000002da8574d0000000066a4b65f" string(32) "000000002da8574d0000000066a4b65f" string(32) "000000002da857480000000066a4b65f"
Output for 5.4.24
string(32) "000000004ff6f47f000000001ead918a" string(32) "000000004ff6f47f000000001ead918a" string(32) "000000004ff6f47a000000001ead918a"
Output for 5.4.23
string(32) "000000003b01c015000000000efeb885" string(32) "000000003b01c015000000000efeb885" string(32) "000000003b01c010000000000efeb885"
Output for 5.4.22
string(32) "000000000c7008cf000000007397a58d" string(32) "000000000c7008cf000000007397a58d" string(32) "000000000c7008ca000000007397a58d"
Output for 5.4.21
string(32) "000000003fafcadd0000000031e79e1c" string(32) "000000003fafcadd0000000031e79e1c" string(32) "000000003fafcad80000000031e79e1c"
Output for 5.4.20
string(32) "000000004afaaa4c0000000047b1ea7c" string(32) "000000004afaaa4c0000000047b1ea7c" string(32) "000000004afaaa490000000047b1ea7c"
Output for 5.4.19
string(32) "0000000006bfde4d00000000605c87f4" string(32) "0000000006bfde4d00000000605c87f4" string(32) "0000000006bfde4800000000605c87f4"
Output for 5.4.18
string(32) "0000000065390c970000000044703016" string(32) "0000000065390c970000000044703016" string(32) "0000000065390c920000000044703016"
Output for 5.4.17
string(32) "0000000021999568000000003e54e4c8" string(32) "0000000021999568000000003e54e4c8" string(32) "000000002199956d000000003e54e4c8"
Output for 5.4.16
string(32) "00000000533e1617000000002e45067f" string(32) "00000000533e1617000000002e45067f" string(32) "00000000533e1612000000002e45067f"
Output for 5.4.15
string(32) "00000000064f845000000000015a6470" string(32) "00000000064f845000000000015a6470" string(32) "00000000064f845500000000015a6470"
Output for 5.4.14
string(32) "00000000401ca3d60000000010216318" string(32) "00000000401ca3d60000000010216318" string(32) "00000000401ca3d30000000010216318"
Output for 5.4.13
string(32) "00000000718721eb0000000025fcea95" string(32) "00000000718721eb0000000025fcea95" string(32) "00000000718721ee0000000025fcea95"
Output for 5.4.12
string(32) "00000000673abc2a000000002b49afd7" string(32) "00000000673abc2a000000002b49afd7" string(32) "00000000673abc2f000000002b49afd7"
Output for 5.4.11
string(32) "0000000047b3a9c90000000063c4dbe8" string(32) "0000000047b3a9c90000000063c4dbe8" string(32) "0000000047b3a9cc0000000063c4dbe8"
Output for 5.4.10
string(32) "0000000015f3ccb3000000005de38039" string(32) "0000000015f3ccb3000000005de38039" string(32) "0000000015f3ccb6000000005de38039"
Output for 5.4.9
string(32) "000000007de0fff600000000568f3aa7" string(32) "000000007de0fff600000000568f3aa7" string(32) "000000007de0fff300000000568f3aa7"
Output for 5.4.8
string(32) "000000000d012f8d000000007a77ca23" string(32) "000000000d012f8d000000007a77ca23" string(32) "000000000d012f88000000007a77ca23"
Output for 5.4.7
string(32) "000000003a207a58000000003b0a3fbb" string(32) "000000003a207a58000000003b0a3fbb" string(32) "000000003a207a5d000000003b0a3fbb"
Output for 5.4.6
string(32) "0000000038e906e70000000043b506d6" string(32) "0000000038e906e70000000043b506d6" string(32) "0000000038e906e20000000043b506d6"
Output for 5.4.5
string(32) "0000000033e9eff400000000097ea717" string(32) "0000000033e9eff400000000097ea717" string(32) "0000000033e9eff100000000097ea717"
Output for 5.4.4
string(32) "000000002a4b884a0000000053ba15cd" string(32) "000000002a4b884a0000000053ba15cd" string(32) "000000002a4b884f0000000053ba15cd"
Output for 5.4.3
string(32) "0000000028fe0f3f0000000037bdafa1" string(32) "0000000028fe0f3f0000000037bdafa1" string(32) "0000000028fe0f3a0000000037bdafa1"
Output for 5.4.2
string(32) "00000000697166ad00000000093f0609" string(32) "00000000697166ad00000000093f0609" string(32) "00000000697166a800000000093f0609"
Output for 5.4.1
string(32) "000000006b3539b10000000072f33e13" string(32) "000000006b3539b10000000072f33e13" string(32) "000000006b3539b40000000072f33e13"
Output for 5.4.0
string(32) "0000000049503384000000001ed711b5" string(32) "0000000049503384000000001ed711b5" string(32) "0000000049503381000000001ed711b5"
Output for 5.3.29
string(32) "0000000000b4b8720000000028472025" string(32) "0000000000b4b8720000000028472025" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.28
string(32) "000000006482b0720000000014417152" string(32) "000000006482b0720000000014417152" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.27
string(32) "00000000433b3251000000006803c124" string(32) "00000000433b3251000000006803c124" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.26
string(32) "000000006dee9f3d000000005cfb554a" string(32) "000000006dee9f3d000000005cfb554a" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.25
string(32) "000000000d388b1a000000000f82855b" string(32) "000000000d388b1a000000000f82855b" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.24
string(32) "000000002c577e94000000000fe61760" string(32) "000000002c577e94000000000fe61760" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.23
string(32) "000000007f7812bc0000000059a3f1b7" string(32) "000000007f7812bc0000000059a3f1b7" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.22
string(32) "0000000024ddb71000000000216ce5ea" string(32) "0000000024ddb71000000000216ce5ea" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.21
string(32) "000000005ab9e815000000005141ccd2" string(32) "000000005ab9e815000000005141ccd2" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.20
string(32) "000000005911104000000000440cf95d" string(32) "000000005911104000000000440cf95d" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.19
string(32) "0000000003322b6400000000554f1348" string(32) "0000000003322b6400000000554f1348" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.18
string(32) "000000000869daca00000000661ce320" string(32) "000000000869daca00000000661ce320" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.17
string(32) "0000000000884fe300000000211ddc67" string(32) "0000000000884fe300000000211ddc67" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.16
string(32) "0000000064e4bf4e0000000039c1d50e" string(32) "0000000064e4bf4e0000000039c1d50e" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.15
string(32) "000000006d9577180000000034ca92a5" string(32) "000000006d9577180000000034ca92a5" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.14
string(32) "00000000056a7d4a000000001763c647" string(32) "00000000056a7d4a000000001763c647" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.13
string(32) "000000001f8ace3b00000000409820f6" string(32) "000000001f8ace3b00000000409820f6" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.12
string(32) "000000001bee8813000000001fc0f4cd" string(32) "000000001bee8813000000001fc0f4cd" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.11
string(32) "0000000057943b2e000000001aeaad45" string(32) "0000000057943b2e000000001aeaad45" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.10
string(32) "000000001ec108500000000037e4acad" string(32) "000000001ec108500000000037e4acad" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.9
string(32) "0000000045897ad7000000005a8f9652" string(32) "0000000045897ad7000000005a8f9652" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.8
string(32) "000000001f65faa5000000001aa0f4f3" string(32) "000000001f65faa5000000001aa0f4f3" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.7
string(32) "0000000019b598ab000000006d6fe1bf" string(32) "0000000019b598ab000000006d6fe1bf" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.6
string(32) "000000001142f53d0000000011395de2" string(32) "000000001142f53d0000000011395de2" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.5
string(32) "000000007f9c44cf000000003d488b82" string(32) "000000007f9c44cf000000003d488b82" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.4
string(32) "000000005be8350d00000000326565f9" string(32) "000000005be8350d00000000326565f9" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.3
string(32) "000000002dac2c40000000007c11d05e" string(32) "000000002dac2c40000000007c11d05e" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.2
string(32) "000000005712edf100000000785a6e62" string(32) "000000005712edf100000000785a6e62" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.1
string(32) "0000000030f864140000000044930bd6" string(32) "0000000030f864140000000044930bd6" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.3.0
string(32) "000000002bb0e0e20000000006329a33" string(32) "000000002bb0e0e20000000006329a33" Fatal error: Call to undefined method Closure::bindTo() in /in/aqARU on line 42
Process exited with code 255.
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC, expecting T_STRING or T_VARIABLE or '$' in /in/aqARU on line 16
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_STATIC, expecting T_STRING or T_VARIABLE or '$' in /in/aqARU on line 16
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/aqARU on line 6
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/aqARU on line 6
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/aqARU on line 6
Process exited with code 255.