3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php session_start(); $_SESSION = array('a' => 5, 'b' => 'e', 'c' => 55); var_dump($_SESSION); $str = session_encode(); var_dump($str); $str = str_replace('e', 'é', $str); var_dump($str); $_SESSION = array(); var_dump($_SESSION); session_decode($str); var_dump($_SESSION);
Output for 7.0.0 - 7.1.0
array(3) { ["a"]=> int(5) ["b"]=> string(1) "e" ["c"]=> int(55) } string(23) "a|i:5;b|s:1:"e";c|i:55;" string(24) "a|i:5;b|s:1:"é";c|i:55;" array(0) { } Warning: session_decode(): Failed to decode session object. Session has been destroyed in /in/Vagd8 on line 11 array(0) { }
Output for 5.4.45, 5.5.29 - 5.5.35, 5.6.13 - 5.6.28
array(3) { ["a"]=> int(5) ["b"]=> string(1) "e" ["c"]=> int(55) } string(23) "a|i:5;b|s:1:"e";c|i:55;" string(24) "a|i:5;b|s:1:"é";c|i:55;" array(0) { } Warning: session_decode(): Failed to decode session object. Session has been destroyed in /in/Vagd8 on line 11 array(1) { ["a"]=> int(5) }
Output for 5.2.3 - 5.4.44, 5.5.0 - 5.5.28, 5.6.0 - 5.6.12
array(3) { ["a"]=> int(5) ["b"]=> string(1) "e" ["c"]=> int(55) } string(23) "a|i:5;b|s:1:"e";c|i:55;" string(24) "a|i:5;b|s:1:"é";c|i:55;" array(0) { } array(3) { ["a"]=> int(5) ["b"]=> NULL ["�";c"]=> int(55) }
Output for 4.4.3 - 4.4.9, 5.0.3 - 5.2.2
<br /> <b>Warning</b>: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent in <b>/in/Vagd8</b> on line <b>2</b><br /> <br /> <b>Warning</b>: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /in/Vagd8:2) in <b>/in/Vagd8</b> on line <b>2</b><br /> array(3) { ["a"]=> int(5) ["b"]=> string(1) "e" ["c"]=> int(55) } string(23) "a|i:5;b|s:1:"e";c|i:55;" string(24) "a|i:5;b|s:1:"é";c|i:55;" array(0) { } array(3) { ["a"]=> int(5) ["b"]=> NULL ["�";c"]=> int(55) }
Output for 5.0.0 - 5.0.2
<br /> <b>Warning</b>: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent in <b>/in/Vagd8</b> on line <b>2</b><br /> <br /> <b>Warning</b>: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /in/Vagd8:2) in <b>/in/Vagd8</b> on line <b>2</b><br /> array(3) { ["a"]=> int(5) ["b"]=> string(1) "e" ["c"]=> int(55) } string(23) "a|i:5;b|s:1:"e";c|i:55;" string(24) "a|i:5;b|s:1:"é";c|i:55;" array(0) { } array(3) { ["a"]=> int(5) ["b"]=> string(1) "�" [";c"]=> int(55) }
Output for 4.3.10 - 4.4.2
<br /> <b>Warning</b>: session_start(): Cannot send session cookie - headers already sent in <b>/in/Vagd8</b> on line <b>2</b><br /> <br /> <b>Warning</b>: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/Vagd8:2) in <b>/in/Vagd8</b> on line <b>2</b><br /> array(3) { ["a"]=> int(5) ["b"]=> string(1) "e" ["c"]=> int(55) } string(23) "a|i:5;b|s:1:"e";c|i:55;" string(24) "a|i:5;b|s:1:"é";c|i:55;" array(0) { } array(3) { ["a"]=> int(5) ["b"]=> NULL ["�";c"]=> int(55) }
Output for 4.3.2 - 4.3.9
<br /> <b>Warning</b>: session_start(): Cannot send session cookie - headers already sent in <b>/in/Vagd8</b> on line <b>2</b><br /> <br /> <b>Warning</b>: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/Vagd8:2) in <b>/in/Vagd8</b> on line <b>2</b><br /> array(3) { ["a"]=> int(5) ["b"]=> string(1) "e" ["c"]=> int(55) } string(23) "a|i:5;b|s:1:"e";c|i:55;" string(24) "a|i:5;b|s:1:"é";c|i:55;" array(0) { } array(3) { ["a"]=> int(5) ["b"]=> string(1) "�" [";c"]=> int(55) }
Output for 4.3.0 - 4.3.1
<br /> <b>Warning</b>: session_start() [<a href='http://www.php.net/function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent in <b>/in/Vagd8</b> on line <b>2</b><br /> <br /> <b>Warning</b>: session_start() [<a href='http://www.php.net/function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /in/Vagd8:2) in <b>/in/Vagd8</b> on line <b>2</b><br /> array(3) { ["a"]=> int(5) ["b"]=> string(1) "e" ["c"]=> int(55) } string(23) "a|i:5;b|s:1:"e";c|i:55;" string(24) "a|i:5;b|s:1:"é";c|i:55;" array(0) { } array(3) { ["a"]=> int(5) ["b"]=> string(1) "�" [";c"]=> int(55) }