3v4l.org

run code in 300+ PHP versions simultaneously
<?php linkk = mysql_connect('localhost','root','root'); mysql_select_db("goal_database",$link); if (isset($_GET["pid"]) && isset($_GET["week"])) { $pid = intval($_GET["pid"]); $week = intval($_GET["week"]); $response = array(); $response["meals"] = array(); // Mysql select query $result = mysql_query("SELECT * FROM Meals WHERE ParticipantID=$pid AND WeekNumber=$week;"); while($row = mysql_fetch_array($result)){ $tmp = array(); $tmp["mid"] = $row["ActivityID"]; $tmp["pid"] = $row["ParticipantID"]; $tmp["week"] = $row["WeekNumber"]; $tmp["day"] = $row["Day"]; $tmp["type"] = $row["Type"]; $tmp["image"] = $row["ImagePath"]; $tmp["comments"] = $row["Comments"]; $tmp["grain"] = $row["GrainAmount"]; $tmp["protein"] = $row["ProteinAmount"]; $tmp["dairy"] = $row["DairyAmount"]; $tmp["vegetable"] = $row["VegetableAmount"]; $tmp["fruit"] = $row["FruitAmount"]; $tmp["attic"] = $row["AtticAmount"]; array_push($response["meals"], $tmp); } // keeping response header to json header('Content-Type: application/json'); // echnoing json result echo json_encode($response); if (mysql_errno()) { $error = "MySQL error ".mysql_errno().": ".mysql_error()."\n<br>When executing:<br>\n$query\n<br>"; echo $error; ?>

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.4.270.0230.05718.89
5.4.260.0070.07718.96
5.4.250.0170.07018.99
5.4.240.0100.08018.92
5.4.230.0130.05718.98
5.4.220.0170.05319.07
5.4.210.0100.06718.84
5.4.200.0130.07019.02
5.4.190.0070.07018.97
5.4.180.0230.06018.84
5.4.170.0170.05319.15
5.4.160.0070.08319.16
5.4.150.0230.07018.86
5.4.140.0170.05016.45
5.4.130.0100.06716.70
5.4.120.0170.05316.71
5.4.110.0130.06016.38
5.4.100.0100.05716.69
5.4.90.0170.06016.61
5.4.80.0170.05016.50
5.4.70.0100.06016.34
5.4.60.0130.04716.47
5.4.50.0070.06716.58
5.4.40.0070.07316.58
5.4.30.0270.04016.64
5.4.20.0200.04316.28
5.4.10.0130.05016.62
5.4.00.0130.06015.95
5.3.280.0170.05314.71
5.3.270.0100.06014.72
5.3.260.0230.04714.54
5.3.250.0130.07314.40
5.3.240.0170.06314.54
5.3.230.0130.07014.78
5.3.220.0070.07314.63
5.3.210.0100.05314.55
5.3.200.0100.06014.77
5.3.190.0130.05714.57
5.3.180.0100.07314.74
5.3.170.0070.06314.63
5.3.160.0230.04014.70
5.3.150.0230.06314.55
5.3.140.0100.06314.64
5.3.130.0130.05714.54
5.3.120.0130.07314.70
5.3.110.0070.07714.43
5.3.100.0130.05314.15
5.3.90.0070.06714.21
5.3.80.0200.05314.17
5.3.70.0070.06714.06
5.3.60.0130.0537.48
5.3.50.0070.07314.11
5.3.40.0100.06713.99
5.3.30.0070.06013.90
5.3.20.0130.04313.62
5.3.10.0030.05713.46
5.3.00.0070.05713.79

preferences:
135.24 ms | 1394 KiB | 7 Q