3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class DB { private static $DBCONN = NULL; private static $OLog = NULL; private static function DBConnection() { if ( self::$DBCONN === NULL) { self::$DBCONN = new PDO('mysql:host=localhost;dbname=test', 'root', ''); } return self::$DBCONN; } public static function setLogger(Logger $logger) { self::$OLog = $logger; } public static function insertWithParams($SQL, $params){ try { self::$OLog->writeToFile( LogType::SQL, $SQL); self::$OLog->writeToFile( LogType::SQL_PARAMS, implode(",", $params)); $statement = self::DBConnection()->prepare($SQL); foreach ($params as $param => &$value) { $statement->bindParam($param, $value, PDO::PARAM_STR); echo 'Param = ' . $param . ' - ' . $value . '</br>'; } $retour = $statement->execute(); self::$OLog->writeToFile( LogType::SUCCESS); return $retour; } catch (Exception $e) { self::$OLog->writeToFile( LogType::ERROR . $e->getMessage()); return $e->getMessage(); } } } class Logger { private $fileToWrite = NULL; private function setFileToWrite(string $file) { if (file_exists($file)) { $this->fileToWrite = $file; return TRUE; } else { throw new Exception("Le fichier $file n existe pas."); } } public static function createLogger(string $fileToWrite) { $oLogger = new Logger(); try { if ($oLogger->setFileToWrite($fileToWrite)) { return $oLogger; } } catch (Exception $e) { //return $e->getMessage(); return NULL; } } public function writeToFile(string $LogType, string $message = '') : bool { //var_dump(debug_backtrace()); if (file_put_contents( $this->fileToWrite, date("Y-m-d h:i:sa") . ' - ' . 'From ' . debug_backtrace()[2]['class'] . ' - ' . $LogType . $message . PHP_EOL, FILE_APPEND) != FALSE ) { return TRUE; } else { return FALSE; } } } $oLogger = Logger::createLogger('log.txt'); DB::setLogger($oLogger);

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.3.60.0090.00918.39
8.3.50.0060.00916.32
8.3.40.0090.00618.61
8.3.30.0100.00718.81
8.3.20.0130.00718.98
8.3.10.0060.00320.92
8.3.00.0080.00023.47
8.2.180.0100.00716.75
8.2.170.0140.00322.96
8.2.160.0120.00320.39
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0120.00019.82
8.2.120.0040.00426.35
8.2.110.0000.01019.27
8.2.100.0060.00617.75
8.2.90.0080.00017.75
8.2.80.0040.00418.92
8.2.70.0030.00518.04
8.2.60.0000.00817.80
8.2.50.0040.00418.10
8.2.40.0090.00019.38
8.2.30.0070.00019.52
8.2.20.0050.00318.10
8.2.10.0000.00718.20
8.2.00.0000.00719.54
8.1.280.0110.00725.92
8.1.270.0050.00322.03
8.1.260.0000.00826.35
8.1.250.0030.00528.09
8.1.240.0040.01122.16
8.1.230.0000.01220.88
8.1.220.0030.00517.74
8.1.210.0060.00318.77
8.1.200.0030.00617.35
8.1.190.0040.00417.00
8.1.180.0000.00818.10
8.1.170.0030.00618.65
8.1.160.0050.00318.84
8.1.150.0040.00418.90
8.1.140.0040.00417.74
8.1.130.0100.00019.05
8.1.120.0020.00517.53
8.1.110.0000.00817.42
8.1.100.0040.00417.49
8.1.90.0030.00517.45
8.1.80.0070.00017.57
8.1.70.0050.00217.41
8.1.60.0060.00317.61
8.1.50.0040.00417.48
8.1.40.0000.00817.45
8.1.30.0000.00817.59
8.1.20.0080.00417.69
8.1.10.0070.00017.59
8.1.00.0000.01117.57
8.0.300.0060.00318.77
8.0.290.0050.00317.00
8.0.280.0040.00218.50
8.0.270.0040.00317.21
8.0.260.0030.00317.29
8.0.250.0040.00417.06
8.0.240.0000.00717.05
8.0.230.0040.00416.96
8.0.220.0000.00716.87
8.0.210.0000.00716.96
8.0.200.0060.00316.95
8.0.190.0000.00716.95
8.0.180.0040.00417.06
8.0.170.0000.00917.02
8.0.160.0040.00416.91
8.0.150.0060.00316.93
8.0.140.0040.00416.97
8.0.130.0030.00613.46
8.0.120.0000.00716.98
8.0.110.0000.00716.98
8.0.100.0020.00516.98
8.0.90.0000.00716.94
8.0.80.0080.00817.02
8.0.70.0040.00417.05
8.0.60.0000.00716.89
8.0.50.0000.00716.97
8.0.30.0080.01117.21
8.0.20.0070.01017.40
8.0.10.0000.00717.24
8.0.00.0150.00716.93
7.4.330.0020.00215.55
7.4.320.0030.00316.61
7.4.300.0030.00316.56
7.4.290.0030.00316.65
7.4.280.0070.00016.64
7.4.270.0070.00016.58
7.4.260.0030.00316.56
7.4.250.0040.00416.53
7.4.240.0000.00816.45
7.4.230.0030.00316.58
7.4.220.0050.00216.35
7.4.210.0080.00616.54
7.4.200.0030.00316.75
7.4.160.0060.01016.52
7.4.140.0070.01117.86
7.4.130.0120.00616.61
7.4.120.0130.00816.57
7.4.110.0060.01116.52
7.4.100.0160.00416.60
7.4.90.0140.00316.57
7.4.80.0110.00719.39
7.4.70.0100.00616.84
7.4.60.0090.00816.64
7.4.50.0040.01116.44
7.4.40.0120.00916.45
7.4.00.0050.01214.93
7.3.330.0000.00513.46
7.3.320.0000.00713.46
7.3.310.0000.00716.50
7.3.300.0000.00716.49
7.3.290.0030.00316.43
7.3.280.0120.00716.47
7.3.260.0110.00816.54
7.3.240.0090.00816.54
7.3.230.0100.01016.51
7.3.210.0170.00716.52
7.3.200.0100.00616.60
7.3.190.0030.01416.45
7.3.180.0060.00916.61
7.3.170.0060.01216.47
7.3.160.0070.01016.59
7.3.120.0000.01415.20
7.3.110.0100.00714.95
7.3.100.0070.01015.01
7.3.90.0000.01214.80
7.3.80.0070.00714.97
7.3.70.0000.01215.06
7.3.60.0030.01514.97
7.3.50.0070.01014.49
7.3.40.0000.01515.02
7.3.30.0060.00914.96
7.3.20.0100.00316.84
7.3.10.0080.00616.69
7.3.00.0050.00716.53
7.2.330.0110.00716.39
7.2.320.0030.01916.73
7.2.310.0100.01616.74
7.2.300.0060.01216.83
7.2.290.0120.01216.89
7.2.250.0000.01915.23
7.2.240.0060.01214.70
7.2.230.0030.01315.14
7.2.220.0030.00914.79
7.2.210.0040.01415.14
7.2.200.0100.00715.20
7.2.190.0120.00315.06
7.2.180.0000.01215.20
7.2.170.0070.00414.75
7.2.130.0150.00316.81
7.2.120.0090.00316.89
7.2.110.0060.00916.73
7.2.100.0030.01016.66
7.2.90.0030.00916.41
7.2.80.0040.00816.82
7.2.70.0000.01416.95
7.2.60.0080.00816.04
7.2.50.0120.00516.13
7.2.40.0120.00515.72
7.2.30.0130.00415.91
7.2.20.0120.00715.90
7.2.10.0080.01216.01
7.2.00.0120.00716.00
7.1.330.0070.00715.62
7.1.320.0060.00315.85
7.1.310.0060.00615.51
7.1.300.0090.00015.60
7.1.290.0070.00716.01
7.1.280.0080.00315.99
7.1.270.0040.00415.60
7.1.260.0040.00815.80
7.1.250.0110.00015.67
7.1.200.0060.01415.66
7.1.170.0200.00613.89
7.1.160.0150.00413.88
7.1.150.0140.00613.85
7.1.140.0190.00813.77
7.1.130.0180.00913.91
7.1.120.0180.00013.89
7.1.110.0170.00713.89
7.1.100.0100.01014.06
7.1.90.0150.00313.68
7.1.80.0100.01113.68
7.1.70.0110.00713.47
7.1.60.0320.00931.53
7.1.50.0280.01131.65
7.1.40.0280.01231.60
7.1.30.0290.01031.54
7.1.20.0320.00631.66
7.1.10.0800.00613.47
7.1.00.0110.00713.92

preferences:
45.83 ms | 401 KiB | 5 Q