3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = count(get_defined_vars()); session_start(); $b = 1; $c = get_defined_vars(); var_dump(array_slice($c, $a + 1));
Output for 7.0.0 - 7.1.0
array(2) { ["b"]=> int(1) ["_SESSION"]=> &array(0) { } }
Output for hhvm-3.10.0 - 3.12.0
array(1) { ["b"]=> int(1) }
Output for 5.4.0 - 5.6.28
array(2) { ["_SESSION"]=> &array(0) { } ["b"]=> int(1) }
Output for 5.2.3 - 5.3.29
array(3) { ["HTTP_SESSION_VARS"]=> &array(0) { } ["_SESSION"]=> &array(0) { } ["b"]=> int(1) }
Output for 4.3.2 - 5.2.2
Warning: session_start(): Cannot send session cookie - headers already sent in /in/3OqkI on line 4 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/3OqkI:4) in /in/3OqkI on line 4 array(3) { ["HTTP_SESSION_VARS"]=> &array(0) { } ["_SESSION"]=> &array(0) { } ["b"]=> int(1) }
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/3OqkI on line 4 Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cache limiter - headers already sent (output started at /in/3OqkI:4) in /in/3OqkI on line 4 array(3) { ["HTTP_SESSION_VARS"]=> &array(0) { } ["_SESSION"]=> &array(0) { } ["b"]=> int(1) }