3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SessionSaveHandler { /** * Constructs the object */ public function __construct() { /** * Register the functions */ session_set_save_handler( array($this, "open"), array($this, "close"), array($this, "read"), array($this, "write"), array($this, "destroy"), array($this, "gc") ); /** * To call the write process before the object cache is destroyed */ register_shutdown_function('session_write_close'); } /** * Opens a connection - Not in use * * @param string $savePath * @param string $sessionName * @return boolean */ public function open($savePath, $sessionName) { return true; } /** * Closing the connection - Not in use * * @return boolean */ public function close() { return true; } /** * Returns the datas for the given session id * * @global WP_Object_Cache $wp_object_cache * @param string $id * @return mixed */ public function read($id) { global $memcachedConnection; return $memcachedConnection->get($this->prepareId($id)); } /** * Saves the datas for the given session id * * @global WP_Object_Cache $wp_object_cache * @param string $id * @param mixed $data */ public function write($id, $data) { global $memcachedConnection; $memcachedConnection->set($this->prepareId($id), $data, 3600); return true; } /** * Deletes the data for the given session id * * @global WP_Object_Cache $wp_object_cache * @param string $id */ public function destroy($id) { global $memcachedConnection; $memcachedConnection->delete($this->prepareId($id)); return true; } /** * Garbage collection - not in use - we have no garbage! * * @param integer $maxlifetime * @return boolean */ public function gc($maxlifetime) { return true; } /** * Returns the id with a prefix * * @param string $id * @return string */ protected function prepareId($id) { return 'SMK_' . md5($_SERVER['SERVER_NAME']) . '_SESSION_' . $id; } } /** * Creates the object and register the new session handler */ $sessionHandler = new SessionSaveHandler();
Output for git.master, git.master_jit, rfc.property-hooks

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:
46.18 ms | 401 KiB | 8 Q