3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class c { public $prop; function __wakeup() { $this->prop = 'awake'; } } $c = new c; $c->prop = new stdclass; $a = [$c]; $a[] =& $c->prop; $s = serialize($a); var_dump($s); var_dump($a); $a2 = unserialize($s); var_dump($a2); $a2[0] = 'ref?'; var_dump($a2);
based on RjTSB
Output for 7.0.0 - 7.2.0
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> &string(5) "awake" } [1]=> &string(5) "awake" } array(2) { [0]=> string(4) "ref?" [1]=> string(5) "awake" }
Output for 5.4.39 - 5.6.28
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> object(stdClass)#4 (0) { } } array(2) { [0]=> string(4) "ref?" [1]=> object(stdClass)#4 (0) { } }
Output for 5.4.38
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &int(140545558229416) } array(2) { [0]=> string(4) "ref?" [1]=> &int(140545558229416) }
Output for 5.4.37
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &int(139817546437032) } array(2) { [0]=> string(4) "ref?" [1]=> &int(139817546437032) }
Output for 5.4.36
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &int(140461710598568) } array(2) { [0]=> string(4) "ref?" [1]=> &int(140461710598568) }
Output for 5.4.35
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &int(139868883354024) } array(2) { [0]=> string(4) "ref?" [1]=> &int(139868883354024) }
Output for 5.4.34
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &int(140490907169192) } array(2) { [0]=> string(4) "ref?" [1]=> &int(140490907169192) }
Output for 5.4.32
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &int(139814400926120) } array(2) { [0]=> string(4) "ref?" [1]=> &int(139814400926120) }
Output for 5.4.31
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &int(139658584773032) } array(2) { [0]=> string(4) "ref?" [1]=> &int(139658584773032) }
Output for 5.4.30
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &int(140276002623912) } array(2) { [0]=> string(4) "ref?" [1]=> &int(140276002623912) }
Output for 5.4.29
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &int(140043469164968) } array(2) { [0]=> string(4) "ref?" [1]=> &int(140043469164968) }
Output for 5.4.28
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &int(140709756350888) } array(2) { [0]=> string(4) "ref?" [1]=> &int(140709756350888) }
Output for 5.4.27
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &int(140645924487592) } array(2) { [0]=> string(4) "ref?" [1]=> &int(140645924487592) }
Output for 5.4.26
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &int(140425893904808) } array(2) { [0]=> string(4) "ref?" [1]=> &int(140425893904808) }
Output for 5.4.25
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &int(139630768423336) } array(2) { [0]=> string(4) "ref?" [1]=> &int(139630768423336) }
Output for 5.4.24
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &int(139692630397352) } array(2) { [0]=> string(4) "ref?" [1]=> &int(139692630397352) }
Output for 5.4.23
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &int(140470343057832) } array(2) { [0]=> string(4) "ref?" [1]=> &int(140470343057832) }
Output for 5.4.22
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &int(140301423116712) } array(2) { [0]=> string(4) "ref?" [1]=> &int(140301423116712) }
Output for 5.4.12 - 5.4.21
string(60) "a:2:{i:0;O:1:"c":1:{s:4:"prop";O:8:"stdClass":0:{}}i:1;R:3;}" array(2) { [0]=> object(c)#1 (1) { ["prop"]=> &object(stdClass)#2 (0) { } } [1]=> &object(stdClass)#2 (0) { } } array(2) { [0]=> object(c)#3 (1) { ["prop"]=> string(5) "awake" } [1]=> &NULL } array(2) { [0]=> string(4) "ref?" [1]=> &NULL }
Output for 5.3.22 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/BoHl8 on line 12
Process exited with code 255.