3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php session_start(); $_SESSION = array('a' => 5, 'b' => 'ee"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); $str = session_encode(); var_dump($str);
Output for 7.0.6 - 7.1.0
array(3) { ["a"]=> int(5) ["b"]=> string(4) "ee"e" ["c"]=> int(55) } string(26) "a|i:5;b|s:4:"ee"e";c|i:55;" string(29) "a|i:5;b|s:4:"éé"é";c|i:55;" array(0) { } Warning: session_decode(): Failed to decode session object. Session has been destroyed in /in/50eT7 on line 11 array(0) { } bool(false)
Output for 5.2.3 - 5.6.20, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.0.5
array(3) { ["a"]=> int(5) ["b"]=> string(4) "ee"e" ["c"]=> int(55) } string(26) "a|i:5;b|s:4:"ee"e";c|i:55;" string(29) "a|i:5;b|s:4:"éé"é";c|i:55;" array(0) { } array(3) { ["a"]=> int(5) ["b"]=> string(4) "éé" ["�";c"]=> int(55) } string(29) "a|i:5;b|s:4:"éé";�";c|i:55;"
Output for 5.6.21 - 5.6.28
array(3) { ["a"]=> int(5) ["b"]=> string(4) "ee"e" ["c"]=> int(55) } string(26) "a|i:5;b|s:4:"ee"e";c|i:55;" string(29) "a|i:5;b|s:4:"éé"é";c|i:55;" array(0) { } Warning: session_decode(): Failed to decode session object. Session has been destroyed in /in/50eT7 on line 11 array(1) { ["a"]=> int(5) } Warning: session_encode(): Cannot encode non-existent session in /in/50eT7 on line 13 bool(false)
Output for 4.3.2 - 5.2.2
Warning: session_start(): Cannot send session cookie - headers already sent in /in/50eT7 on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/50eT7:2) in /in/50eT7 on line 2 array(3) { ["a"]=> int(5) ["b"]=> string(4) "ee"e" ["c"]=> int(55) } string(26) "a|i:5;b|s:4:"ee"e";c|i:55;" string(29) "a|i:5;b|s:4:"éé"é";c|i:55;" array(0) { } array(3) { ["a"]=> int(5) ["b"]=> string(4) "éé" ["�";c"]=> int(55) } string(29) "a|i:5;b|s:4:"éé";�";c|i:55;"
Output for 4.3.0 - 4.3.1
Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cookie - headers already sent in /in/50eT7 on line 2 Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cache limiter - headers already sent (output started at /in/50eT7:2) in /in/50eT7 on line 2 array(3) { ["a"]=> int(5) ["b"]=> string(4) "ee"e" ["c"]=> int(55) } string(26) "a|i:5;b|s:4:"ee"e";c|i:55;" string(29) "a|i:5;b|s:4:"éé"é";c|i:55;" array(0) { } array(3) { ["a"]=> int(5) ["b"]=> string(4) "éé" ["�";c"]=> int(55) } string(29) "a|i:5;b|s:4:"éé";�";c|i:55;"