3v4l.org

run code in 300+ PHP versions simultaneously
<?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 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 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.0.5, 5.1.0 - 5.1.6, 5.2.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.3.11, 4.4.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) }

preferences:
268.34 ms | 1395 KiB | 162 Q