3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class foo { } $foo = &new foo(); $foo->bar = 'baz'; $blah = $foo; debug_zval_dump($foo); $blah->bar = 'bazbaz'; debug_zval_dump($foo); debug_zval_dump($blah);
Output for hhvm-3.10.0 - 3.12.0
object(foo)#1 (1) refcount(3){ ["bar"]=> string(3) "baz" refcount(1) } object(foo)#1 (1) refcount(3){ ["bar"]=> string(6) "bazbaz" refcount(1) } object(foo)#1 (1) refcount(3){ ["bar"]=> string(6) "bazbaz" refcount(1) }
Output for 5.3.0 - 5.6.21
Deprecated: Assigning the return value of new by reference is deprecated in /in/n4ENY on line 5 object(foo)#1 (1) refcount(1){ ["bar"]=> string(3) "baz" refcount(1) } object(foo)#1 (1) refcount(1){ ["bar"]=> string(6) "bazbaz" refcount(1) } object(foo)#1 (1) refcount(2){ ["bar"]=> string(6) "bazbaz" refcount(1) }
Output for 5.2.7 - 5.2.17
Strict Standards: Assigning the return value of new by reference is deprecated in /in/n4ENY on line 5 object(foo)#1 (1) refcount(1){ ["bar"]=> string(3) "baz" refcount(1) } object(foo)#1 (1) refcount(1){ ["bar"]=> string(6) "bazbaz" refcount(1) } object(foo)#1 (1) refcount(2){ ["bar"]=> string(6) "bazbaz" refcount(1) }
Output for 5.0.0 - 5.2.6
Strict Standards: Assigning the return value of new by reference is deprecated in /in/n4ENY on line 5 object(foo)#1 (1) refcount(3){ ["bar"]=> string(3) "baz" refcount(1) } object(foo)#1 (1) refcount(3){ ["bar"]=> string(6) "bazbaz" refcount(1) } object(foo)#1 (1) refcount(3){ ["bar"]=> string(6) "bazbaz" refcount(1) }
Output for 4.3.0 - 4.4.9
object(foo)(1) refcount(1){ ["bar"]=> string(3) "baz" refcount(3) } object(foo)(1) refcount(1){ ["bar"]=> string(3) "baz" refcount(2) } object(foo)(1) refcount(2){ ["bar"]=> string(6) "bazbaz" refcount(1) }