3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MySessionStorage implements SessionHandlerInterface { private $path; function open($savePath, $sessionName) { $this->path = $savePath; return true; } function close() { return true; } function read($id) { return true; } function write($id, $data) { return true; } function destroy($id) { return true; } function gc($maxlifetime) { return test; } } session_set_save_handler(new MySessionStorage); session_start();
Output for 8.1.24 - 8.1.28, 8.2.11 - 8.2.18, 8.3.0 - 8.3.6
Deprecated: Return type of MySessionStorage::open($savePath, $sessionName) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/6eaFB on line 8 Deprecated: Return type of MySessionStorage::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/6eaFB on line 14 Deprecated: Return type of MySessionStorage::read($id) should either be compatible with SessionHandlerInterface::read(string $id): string|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/6eaFB on line 19 Deprecated: Return type of MySessionStorage::write($id, $data) should either be compatible with SessionHandlerInterface::write(string $id, string $data): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/6eaFB on line 24 Deprecated: Return type of MySessionStorage::destroy($id) should either be compatible with SessionHandlerInterface::destroy(string $id): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/6eaFB on line 29 Deprecated: Return type of MySessionStorage::gc($maxlifetime) should either be compatible with SessionHandlerInterface::gc(int $max_lifetime): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/6eaFB on line 34 Warning: session_set_save_handler(): Session save handler cannot be changed after headers have already been sent in /in/6eaFB on line 41 Warning: session_start(): Session cannot be started after headers have already been sent in /in/6eaFB on line 44
Output for 7.1.3, 7.1.7 - 7.1.10, 7.1.16, 7.1.21 - 7.1.33, 7.2.0, 7.2.2, 7.2.10 - 7.2.14, 7.2.16 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
Warning: session_start(): Failed to read session data: user (path: ) in /in/6eaFB on line 44
Output for 5.5.36, 5.6.1, 5.6.26, 5.6.30 - 5.6.35, 7.0.1, 7.0.10, 7.0.12 - 7.0.15, 7.0.24, 7.0.27, 7.0.30 - 7.0.31, 7.1.0 - 7.1.2, 7.1.4 - 7.1.6, 7.1.11 - 7.1.15, 7.1.17 - 7.1.20, 7.2.1, 7.2.3 - 7.2.9, 7.2.15

Process exited with code 137.
Output for 5.5.0 - 5.5.19, 5.5.21 - 5.5.35, 5.5.37 - 5.5.38, 5.6.0, 5.6.2 - 5.6.25, 5.6.27 - 5.6.29, 5.6.36 - 5.6.40, 7.0.0, 7.0.2 - 7.0.9, 7.0.11, 7.0.16 - 7.0.23, 7.0.25 - 7.0.26, 7.0.28 - 7.0.29, 7.0.32 - 7.0.33
Output for 5.5.20
Notice: Use of undefined constant test - assumed 'test' in /in/6eaFB on line 36

preferences:
162.28 ms | 401 KiB | 216 Q