3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (empty($_SESSION)) session_start(); if (empty($_SESSION['lastAccess'])) $_SESSION['lastAccess'] = time(); else { $_SESSION['lastAccess'] -= time(); } var_dump($_SESSION['lastAccess']); echo(time()-5); if ($_SESSION['lastAccess'] > time()-5) { session_destroy(); echo('session timeout'); }
Output for 5.2.3 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.13, 7.3.0 - 7.3.1
int(1430840072) 1430840067session timeout
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
Warning: session_start(): Cannot send session cookie - headers already sent in /in/JI98X on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/JI98X:2) in /in/JI98X on line 2 int(1430840072) 1430840067session timeout
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/JI98X 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/JI98X:2) in /in/JI98X on line 2 int(1430840072) 1430840067session timeout

preferences:
190.49 ms | 402 KiB | 229 Q