3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump([ $original_set = [ 'arrayobject' => new arrayobject( [3] ), 'reference?' => [5] ], $original_serialized = serialize( $original_set ), $original_unserialized = unserialize( $original_serialized ), $withreference_serialized = preg_replace( '/a:1:{i:0;i:5;}}/', 'R:4;}', $original_serialized ), $withreference_unserialized = unserialize( $withreference_serialized ), $withreference_unserialized['arrayobject'][9] = 8, $withreference_unserialized, $withreference_unserialized['arrayobject'][9] === $withreference_unserialized['reference?'][9] ? 'looks like a reference' : 'does not look like a reference' , ]) ;
based on ZfSZ6
Output for 7.1.10 - 7.2.0
array(8) { [0]=> array(2) { ["arrayobject"]=> object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(1) { [0]=> int(3) } } ["reference?"]=> array(1) { [0]=> int(5) } } [1]=> string(110) "a:2:{s:11:"arrayobject";C:11:"ArrayObject":29:{x:i:0;a:1:{i:0;i:3;};m:a:0:{}}s:10:"reference?";a:1:{i:0;i:5;}}" [2]=> array(2) { ["arrayobject"]=> object(ArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(1) { [0]=> int(3) } } ["reference?"]=> array(1) { [0]=> int(5) } } [3]=> string(100) "a:2:{s:11:"arrayobject";C:11:"ArrayObject":29:{x:i:0;a:1:{i:0;i:3;};m:a:0:{}}s:10:"reference?";R:4;}" [4]=> array(2) { ["arrayobject"]=> object(ArrayObject)#3 (1) { ["storage":"ArrayObject":private]=> array(2) { [0]=> int(3) [9]=> int(8) } } ["reference?"]=> array(2) { [0]=> int(3) [9]=> int(8) } } [5]=> int(8) [6]=> array(2) { ["arrayobject"]=> object(ArrayObject)#3 (1) { ["storage":"ArrayObject":private]=> array(2) { [0]=> int(3) [9]=> int(8) } } ["reference?"]=> array(2) { [0]=> int(3) [9]=> int(8) } } [7]=> string(22) "looks like a reference" }
Output for 7.0.0 - 7.1.7

Process exited with code 139.
Output for 5.4.2 - 5.6.21
array(8) { [0]=> array(2) { ["arrayobject"]=> object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(1) { [0]=> int(3) } } ["reference?"]=> array(1) { [0]=> int(5) } } [1]=> string(110) "a:2:{s:11:"arrayobject";C:11:"ArrayObject":29:{x:i:0;a:1:{i:0;i:3;};m:a:0:{}}s:10:"reference?";a:1:{i:0;i:5;}}" [2]=> array(2) { ["arrayobject"]=> object(ArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(1) { [0]=> int(3) } } ["reference?"]=> array(1) { [0]=> int(5) } } [3]=> string(100) "a:2:{s:11:"arrayobject";C:11:"ArrayObject":29:{x:i:0;a:1:{i:0;i:3;};m:a:0:{}}s:10:"reference?";R:4;}" [4]=> array(2) { ["arrayobject"]=> object(ArrayObject)#3 (1) { ["storage":"ArrayObject":private]=> &array(2) { [0]=> int(3) [9]=> int(8) } } ["reference?"]=> &array(2) { [0]=> int(3) [9]=> int(8) } } [5]=> int(8) [6]=> array(2) { ["arrayobject"]=> object(ArrayObject)#3 (1) { ["storage":"ArrayObject":private]=> &array(2) { [0]=> int(3) [9]=> int(8) } } ["reference?"]=> &array(2) { [0]=> int(3) [9]=> int(8) } } [7]=> string(22) "looks like a reference" }
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/eGMQ1 on line 3
Process exited with code 255.