3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { private $bar = 'baz'; } $foo = new Foo(); echo spl_object_hash($foo); echo '<br />'; $reader = function & ($object, $property) { $value = & Closure::bind(function & () use ($property) { return $this->$property; }, $object, $object)->__invoke(); return $value; }; $bar = & $reader($foo, 'bar'); //var_dump($bar); $bar = 'tab1'; unset($bar); echo spl_object_hash($foo); var_dump($foo);
based on Kj8nc
Output for 7.2.0
000000006ca9dac700000000404bf5bf<br />000000006ca9dac700000000404bf5bfobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 7.1.10
000000004307320d0000000076d7712b<br />000000004307320d0000000076d7712bobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 7.1.7
000000007e6705c8000000007932897e<br />000000007e6705c8000000007932897eobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 7.1.6
0000000058fabd29000000001e270539<br />0000000058fabd29000000001e270539object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 7.1.5
00000000262b1da700000000396821ec<br />00000000262b1da700000000396821ecobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 7.1.0
0000000033d8578e000000004c76ae60<br />0000000033d8578e000000004c76ae60object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 7.0.20
000000001b9fb8300000000057a41971<br />000000001b9fb8300000000057a41971object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 7.0.6
0000000011118a23000000004309b90c<br />0000000011118a23000000004309b90cobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 7.0.5
0000000013a1b124000000007a20a357<br />0000000013a1b124000000007a20a357object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 7.0.4
000000006d560eb10000000073c5f4fe<br />000000006d560eb10000000073c5f4feobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 7.0.3
000000007b3bd8c1000000004bb47158<br />000000007b3bd8c1000000004bb47158object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 7.0.2
0000000078fcef830000000079370299<br />0000000078fcef830000000079370299object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 7.0.1
000000006fd58f5f0000000058401d09<br />000000006fd58f5f0000000058401d09object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 7.0.0
0000000065c8d8a4000000005f4a935f<br />0000000065c8d8a4000000005f4a935fobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.6.28
000000005360c404000000000c663774<br />000000005360c404000000000c663774object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.6.21
000000001831df420000000031fc44c9<br />000000001831df420000000031fc44c9object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.6.20
000000007767568b0000000038205233<br />000000007767568b0000000038205233object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.6.19
000000000c155416000000006bf7e9b6<br />000000000c155416000000006bf7e9b6object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.6.18
0000000068e979440000000011bd87c9<br />0000000068e979440000000011bd87c9object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.6.17
000000004e16bc8c0000000040cf5623<br />000000004e16bc8c0000000040cf5623object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.6.16
000000005ea0f77b000000007f0a159d<br />000000005ea0f77b000000007f0a159dobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.6.15
000000006a84a1c500000000642d9901<br />000000006a84a1c500000000642d9901object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.6.14
000000003664013b0000000071cf06fd<br />000000003664013b0000000071cf06fdobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.6.13
000000007a55a0450000000029d7e59a<br />000000007a55a0450000000029d7e59aobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.6.12
000000007e04563c0000000023d78f77<br />000000007e04563c0000000023d78f77object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.6.11
00000000475f9f3a000000004ab0cc16<br />00000000475f9f3a000000004ab0cc16object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.6.10
000000007b5f144d0000000059233914<br />000000007b5f144d0000000059233914object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.6.9
0000000037196791000000002d6e6c0b<br />0000000037196791000000002d6e6c0bobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.6.8
0000000019da803e000000004240b295<br />0000000019da803e000000004240b295object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.5.35
000000006979f5a3000000001d4fed06<br />000000006979f5a3000000001d4fed06object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.5.34
0000000004a1330f000000003c2f1ec7<br />0000000004a1330f000000003c2f1ec7object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.5.33
00000000494dbdf90000000068d3deb5<br />00000000494dbdf90000000068d3deb5object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.5.32
000000002215b4db000000000f443070<br />000000002215b4db000000000f443070object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.5.31
00000000309474660000000034de9643<br />00000000309474660000000034de9643object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.5.30
0000000067b8bd22000000001e892c72<br />0000000067b8bd22000000001e892c72object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.5.29
00000000605c355400000000225a98b7<br />00000000605c355400000000225a98b7object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.5.28
000000002e56f610000000001f0a821e<br />000000002e56f610000000001f0a821eobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.5.27
000000005d7ef2f20000000053258048<br />000000005d7ef2f20000000053258048object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.5.26
000000004f5fb09f000000000a563453<br />000000004f5fb09f000000000a563453object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.5.25
000000001cc8e8f900000000260d4c68<br />000000001cc8e8f900000000260d4c68object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.5.24
000000007efe5595000000002f0d8cca<br />000000007efe5595000000002f0d8ccaobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.45
000000006b34f27300000000607e0023<br />000000006b34f27300000000607e0023object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.44
000000000d76c73a00000000001e6052<br />000000000d76c73a00000000001e6052object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.43
000000000a17372a00000000453fc35b<br />000000000a17372a00000000453fc35bobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.42
0000000079ab8a37000000007b9571cc<br />0000000079ab8a37000000007b9571ccobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.41
00000000190bb5fe0000000078f7fdc8<br />00000000190bb5fe0000000078f7fdc8object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.40
000000007407ad820000000009f015e0<br />000000007407ad820000000009f015e0object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.39
0000000069795479000000003baf5710<br />0000000069795479000000003baf5710object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.38
0000000001b808100000000020ed1043<br />0000000001b808100000000020ed1043object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.37
000000007dd7f204000000001561890f<br />000000007dd7f204000000001561890fobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.36
00000000653d4a25000000003814609f<br />00000000653d4a25000000003814609fobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.35
0000000049df734a0000000000bccaa9<br />0000000049df734a0000000000bccaa9object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.34
000000003c5d0dbd0000000004b028c1<br />000000003c5d0dbd0000000004b028c1object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.32
0000000037e2c8e1000000004a00768e<br />0000000037e2c8e1000000004a00768eobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.31
00000000665725f50000000061a9901e<br />00000000665725f50000000061a9901eobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.30
000000007595da1400000000360ac5cc<br />000000007595da1400000000360ac5ccobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.29
0000000026269e7c000000004c72923e<br />0000000026269e7c000000004c72923eobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.28
00000000115dcfe90000000049cd9e57<br />00000000115dcfe90000000049cd9e57object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.27
000000001d608af60000000007d73c6e<br />000000001d608af60000000007d73c6eobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.26
00000000548bafa400000000755c8574<br />00000000548bafa400000000755c8574object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.25
000000005880c0a1000000006486153e<br />000000005880c0a1000000006486153eobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.24
000000002d34c32f000000003ae1c957<br />000000002d34c32f000000003ae1c957object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.23
000000004de0a75b000000007d990d24<br />000000004de0a75b000000007d990d24object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.22
0000000033a8e9b000000000207a5d72<br />0000000033a8e9b000000000207a5d72object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.21
000000005a5fc0f2000000000075e33a<br />000000005a5fc0f2000000000075e33aobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.20
0000000078696dd2000000000cc2290d<br />0000000078696dd2000000000cc2290dobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.19
000000000381d0ab00000000497eec96<br />000000000381d0ab00000000497eec96object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.18
00000000101b540c000000004876537a<br />00000000101b540c000000004876537aobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.17
00000000208e2acc0000000056a5cf27<br />00000000208e2acc0000000056a5cf27object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.16
0000000051567ee9000000007e1ff74d<br />0000000051567ee9000000007e1ff74dobject(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.15
000000002d0fae0e0000000051cdffc4<br />000000002d0fae0e0000000051cdffc4object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.14
000000001ce5649c0000000076cb4808<br />000000001ce5649c0000000076cb4808object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.13
0000000020c357d300000000645d4de1<br />0000000020c357d300000000645d4de1object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.4.12
00000000041f7fd8000000000e61cc26<br />00000000041f7fd8000000000e61cc26object(Foo)#1 (1) { ["bar":"Foo":private]=> string(4) "tab1" }
Output for 5.3.29
000000003080b1fa000000007564fccc<br /> Fatal error: Call to undefined method Closure::bind() in /in/jcIWr on line 12
Process exited with code 255.
Output for 5.3.28
000000007b2585ca0000000040fe1dbf<br /> Fatal error: Call to undefined method Closure::bind() in /in/jcIWr on line 12
Process exited with code 255.
Output for 5.3.27
000000001e947f59000000004008363b<br /> Fatal error: Call to undefined method Closure::bind() in /in/jcIWr on line 12
Process exited with code 255.
Output for 5.3.26
00000000546ca9030000000053cd0ab0<br /> Fatal error: Call to undefined method Closure::bind() in /in/jcIWr on line 12
Process exited with code 255.
Output for 5.3.25
00000000363d8e5d000000002a000151<br /> Fatal error: Call to undefined method Closure::bind() in /in/jcIWr on line 12
Process exited with code 255.
Output for 5.3.24
000000003d61fae4000000000b424782<br /> Fatal error: Call to undefined method Closure::bind() in /in/jcIWr on line 12
Process exited with code 255.
Output for 5.3.23
000000001c855e8b000000005c84a6e9<br /> Fatal error: Call to undefined method Closure::bind() in /in/jcIWr on line 12
Process exited with code 255.
Output for 5.3.22
00000000268fd5c500000000602f4805<br /> Fatal error: Call to undefined method Closure::bind() in /in/jcIWr on line 12
Process exited with code 255.