3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Session_Database{ public function close(){} } class Session { private Session_Database $db; public function __construct(){ // Instantiate new Database object $this->db = new Session_Database(); // Set handler to overide SESSION session_set_save_handler( [$this, '_open'], [$this, '_close'], [$this, '_read'], [$this, '_write'], [$this, '_destroy'], [$this, '_gc'] ); // Start the session session_start(); } public function _open(string $savePath, string $sessionName): bool {return true;} public function _read(string $sessionId): string {return '';} public function _write(string $sessionId, string $data): bool {return true;} public function _destroy(string $sessionId): bool {return true;} public function _gc(int $lifetime): bool {return true;} public function _close(): bool { echo 'closing session'; // Close the database connection $this->db->close(); return true; } } new Session; session_write_close();

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.30.0090.00719.50
8.5.20.0100.00920.11
8.5.10.0100.00816.72
8.5.00.0110.00919.96
8.4.180.0120.01021.99
8.4.170.0100.01221.93
8.4.160.0110.01123.92
8.4.150.0080.00516.82
8.4.140.0030.00617.61
8.4.130.0090.00817.75
8.4.120.0160.00524.06
8.4.110.0120.00819.79
8.4.100.0130.00618.80
8.4.90.0080.00318.99
8.4.80.0140.00718.53
8.4.70.0120.00618.20
8.4.60.0060.00218.85
8.4.50.0080.00918.83
8.4.40.0040.01219.38
8.4.30.0060.01320.52
8.4.20.0110.00720.61
8.4.10.0110.00819.59
8.3.300.0100.00918.25
8.3.290.0130.00720.79
8.3.280.0150.00818.28
8.3.270.0140.00516.78
8.3.260.0030.00516.52
8.3.250.0120.00619.05
8.3.240.0120.00717.30
8.3.230.0120.00616.47
8.3.220.0090.01019.05
8.3.210.0100.00816.60
8.3.200.0050.00316.61
8.3.190.0100.00817.05
8.3.180.0140.00317.14
8.3.170.0160.00318.80
8.3.160.0120.00617.33
8.3.150.0170.00317.29
8.3.140.0070.00717.22
8.3.130.0080.00018.54
8.3.120.0000.00920.70
8.3.110.0070.00420.94
8.3.100.0000.00824.06
8.3.90.0040.00426.77
8.3.80.0060.00318.43
8.3.70.0120.00916.63
8.3.60.0000.01416.66
8.3.50.0110.01118.28
8.3.40.0120.00321.95
8.3.30.0120.00922.96
8.3.20.0060.01223.50
8.3.10.0090.00923.36
8.3.00.0120.00622.96
8.2.300.0080.01218.86
8.2.290.0100.00820.48
8.2.280.0110.00818.43
8.2.270.0180.00016.96
8.2.260.0040.00416.48
8.2.250.0090.00016.71
8.2.240.0060.00317.24
8.2.230.0060.00322.58
8.2.220.0040.00437.54
8.2.210.0040.00426.77
8.2.200.0060.00316.75
8.2.190.0120.00918.54
8.2.180.0060.01216.63
8.2.170.0180.00422.96
8.2.160.0090.01222.96
8.2.150.0140.00722.96
8.2.140.0140.00022.96
8.2.130.0110.00422.96
8.2.120.0070.00722.96
8.2.110.0130.00622.96
8.2.100.0040.01122.96
8.2.90.0100.01022.96
8.2.80.0150.00622.96
8.2.70.0150.00622.96
8.2.60.0170.00322.96
8.2.50.0110.00722.96
8.2.40.0070.01322.96
8.2.30.0060.01322.96
8.2.20.0030.01722.96
8.2.10.0100.01022.96
8.2.00.0100.01022.96
8.1.340.0150.00521.63
8.1.330.0110.00723.77
8.1.320.0130.00716.26
8.1.310.0040.00418.26
8.1.300.0040.00418.41
8.1.290.0040.00430.84
8.1.280.0060.00925.92
8.1.270.0110.00722.96
8.1.260.0060.01222.96
8.1.250.0040.01122.96
8.1.240.0100.01022.96
8.1.230.0060.01222.96
8.1.220.0160.00022.96
8.1.210.0060.01922.96
8.1.200.0140.00422.96
8.1.190.0070.00722.96
8.1.180.0150.00022.96
8.1.170.0090.00622.96
8.1.160.0070.01122.96
8.1.150.0140.00722.96
8.1.140.0100.01022.96
8.1.130.0100.00722.96
8.1.120.0040.01122.96
8.1.110.0070.00722.96
8.1.100.0140.00022.96
8.1.90.0140.00022.96
8.1.80.0080.00622.96
8.1.70.0060.00922.96
8.1.60.0090.00622.96
8.1.50.0070.00722.96
8.1.40.0040.01122.96
8.1.30.0040.01122.96
8.1.20.0110.00422.96
8.1.10.0030.01022.96
8.1.00.0040.01122.96

preferences:
46.28 ms | 983 KiB | 5 Q