3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(-1); ini_set('display_errors', 'On'); ?> <?php $servername = "xxxx"; $username = "xxxx"; $password = "xxxx"; $dbname= "xxxx"; try { $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected successfully"; } catch(PDOException $e) { echo "Connection failed: " . $e->getMessage(); } ?> <?php <html> <head> <title>Form</title> </head> <body> <form action="req.php" method="post"> <table> <tr> <td>Nome</td> <td><input type="text" name="nome"/></td> </tr><tr> <td>Cognome</td> <td><select name="cognome"> <?php $stmt = $conn->prepare("SELECT id, cognome FROM req_table"); $stmt->execute(); // set the resulting array to associative while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { foreach($row as $value) { echo '<option value="' . $row['id'] . '">'; echo '<option value="' . $row['cognome'] . '</option>'; } } </select></td> </tr><tr> <td>Indirizzo</td> <td><select name="indirizzo"> <?php $stmt = $conn->prepare("SELECT id, indirizzo FROM req_table"); $stmt->execute(); // set the resulting array to associative while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { foreach($row as $value) { echo '<option value="' . $row['id'] . '">'; echo '<option value="' . $row['indirizzo'] . '</option>'; } } </select></td> </tr><tr> <td colspan="2" style="text-align: center;"> <input type="submit" name="Invia" value="Submit" /> </td> </tr> </table> </form> </body> </html> ?>

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)
5.6.110.0170.07721.11
5.6.100.0100.06721.02
5.6.90.0030.09320.98
5.6.80.0100.03320.39
5.5.270.0030.04020.83
5.5.260.0000.07020.94
5.5.250.0130.07320.69
5.5.240.0100.07320.22
5.4.430.0200.07719.52
5.4.420.0230.06019.27
5.4.410.0270.05719.42
5.4.400.0170.06319.14
5.4.390.0270.07319.15
5.4.380.0230.06319.13
5.4.370.0300.04019.14
5.4.360.0230.08018.85
5.4.350.0200.04719.06
5.4.340.0230.03318.99
5.4.320.0330.03719.08
5.4.310.0200.07719.08
5.4.300.0230.07019.21
5.4.290.0300.06719.13
5.4.280.0300.04319.09
5.4.270.0230.05319.26
5.4.260.0230.07719.09
5.4.250.0230.04718.99
5.4.240.0270.04018.84
5.4.230.0270.06319.07
5.4.220.0100.06318.84
5.4.210.0100.05019.26
5.4.200.0230.06319.14
5.4.190.0300.06318.84
5.4.180.0200.07319.07
5.4.170.0170.05018.97
5.4.160.0270.06719.20
5.4.150.0230.07318.85
5.4.140.0300.06716.35
5.4.130.0200.06716.30
5.4.120.0200.05016.50
5.4.110.0230.06016.61
5.4.100.0230.07016.59
5.4.90.0230.07016.40
5.4.80.0200.07016.54
5.4.70.0200.03316.23
5.4.60.0200.05016.52
5.4.50.0200.07316.55
5.4.40.0200.03716.53
5.4.30.0200.03316.53
5.4.20.0200.06716.43
5.4.10.0300.06716.52
5.4.00.0170.05016.11
5.3.290.0270.04314.76
5.3.280.0270.07014.55
5.3.270.0200.05014.52
5.3.260.0200.05314.70
5.3.250.0430.05014.49
5.3.240.0270.07014.54
5.3.230.0300.07014.51
5.3.220.0200.04714.60
5.3.210.0230.07314.52
5.3.200.0330.06714.42
5.3.190.0270.04314.51
5.3.180.0230.04714.43
5.3.170.0300.03314.50
5.3.160.0230.07314.52
5.3.150.0130.08014.42
5.3.140.0230.06014.41
5.3.130.0270.07014.57
5.3.120.0230.06714.42
5.3.110.0230.05714.39
5.3.100.0300.07013.99
5.3.90.0230.04713.96
5.3.80.0230.05014.00
5.3.70.0270.06314.05
5.3.60.0230.07013.86
5.3.50.0270.07013.98
5.3.40.0400.03013.89
5.3.30.0300.03713.75
5.3.20.0270.05713.54
5.3.10.0230.04713.50
5.3.00.0200.04713.48
5.2.170.0200.05712.47
5.2.160.0200.06012.47
5.2.150.0230.05012.47
5.2.140.0170.06012.47
5.2.130.0170.03712.47
5.2.120.0200.05012.47
5.2.110.0270.02712.47
5.2.100.0200.06012.47
5.2.90.0130.06312.47
5.2.80.0230.03012.47
5.2.70.0230.05312.47
5.2.60.0170.05712.47
5.2.50.0300.04312.47
5.2.40.0170.05312.47
5.2.30.0170.05012.47
5.2.20.0170.04712.47
5.2.10.0030.03312.47
5.2.00.0130.02312.47
5.1.60.0170.01712.47
5.1.50.0100.02712.47
5.1.40.0100.02312.47
5.1.30.0130.03012.47
5.1.20.0130.02712.47
5.1.10.0130.02012.47
5.1.00.0130.02012.47
5.0.50.0070.02012.47
5.0.40.0100.01712.47
5.0.30.0030.03012.47
5.0.20.0100.02712.47
5.0.10.0070.02012.47
5.0.00.0030.03012.47
4.4.90.0070.03712.47
4.4.80.0100.03312.47
4.4.70.0130.02712.47
4.4.60.0070.02012.47
4.4.50.0070.01712.47
4.4.40.0100.02312.47
4.4.30.0030.01712.47
4.4.20.0030.01712.47
4.4.10.0030.01712.47
4.4.00.0000.02712.47
4.3.110.0030.02012.47
4.3.100.0070.01312.47
4.3.90.0030.01712.47
4.3.80.0030.03012.47
4.3.70.0070.01012.47
4.3.60.0030.03312.47
4.3.50.0030.03312.47
4.3.40.0070.02012.47
4.3.30.0000.02312.47
4.3.20.0000.03012.47
4.3.10.0000.01712.47
4.3.00.0000.01712.47

preferences:
145.31 ms | 1405 KiB | 7 Q