3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MySessionHandler implements \SessionHandlerInterface { public function open($savePath, $sessionName) { echo 'open ' . $sessionName . "\n"; } public function close() { echo 'close' . "\n"; } public function read($id) { echo 'read ' . $id . "\n"; } public function write($id, $data) { echo 'write ' . $id . ': ' . $data . "\n"; } public function destroy($id) { echo 'destroy ' . $id . "\n"; } public function gc($maxlifetime) { echo 'gc ' . $maxlifetime . "\n"; } } $handler = new MySessionHandler(); session_set_save_handler($handler, true); session_start(); $_SESSION['foo'] = 'bar'; echo session_id(); session_regenerate_id(); echo session_id(); session_destroy(); session_start(); session_write_close();

preferences:
34.21 ms | 402 KiB | 5 Q