3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test implements SessionHandlerInterface { public function close() { return true; } public function destroy($session_id) { return true; } public function gc($maxlifetime) { return true; } public function open($save_path, $session_name) { return true; } public function read($session_id) { return 'testtest|s:7:"testing";'; } public function write($session_id, $session_data) { $status = session_status(); if ($status === PHP_SESSION_NONE) { echo 'session is closed' . PHP_EOL; } elseif ($status === PHP_SESSION_ACTIVE) { echo 'session is active' . PHP_EOL; } else { echo 'what happened'; } return true; } } $test = new Test(); session_set_save_handler($test, true); session_start(); session_write_close(); echo 'none: '; var_dump(PHP_SESSION_NONE ); echo 'active: '; var_dump(PHP_SESSION_ACTIVE );
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of Test::open($save_path, $session_name) 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/ha3bd on line 20 Deprecated: Return type of Test::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/ha3bd on line 5 Deprecated: Return type of Test::read($session_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/ha3bd on line 25 Deprecated: Return type of Test::write($session_id, $session_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/ha3bd on line 30 Deprecated: Return type of Test::destroy($session_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/ha3bd on line 10 Deprecated: Return type of Test::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/ha3bd on line 15 Warning: session_set_save_handler(): Session save handler cannot be changed after headers have already been sent in /in/ha3bd on line 45 Warning: session_start(): Session cannot be started after headers have already been sent in /in/ha3bd on line 46 none: int(1) active: int(2)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
52.91 ms | 405 KiB | 8 Q