3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getGoals(){ $link = 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["goals"] = array(); // Mysql select query to retrieve nutrition goal $nutrition_result = mysql_query("SELECT Description FROM Goals WHERE ParticipantID=$pid AND WeekNumber=$week AND Type='NUTRITION';"); $row = mysql_fetch_array($nutrition_result); $nutrition_goal = $row[0]; $tmp = array(); $tmp["nutrition"] = $nutrition_goal; array_push($response["goals"], $tmp); // Mysql query to retrieve exervise goal $exercise_result = mysql_query("SELECT Description FROM Goals WHERE ParticipantID=$pid AND WeekNumber=$week AND Type='EXERCISE';"); $row = mysql_fetch_array($exercise_result; $exercise_goal = $row[0]; $tmp["exercise"] = $exercise_goal; array_push($response["goals"], $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; } } } getGoals(); ?>

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.250.0070.05018.83
5.4.240.0130.05718.73
5.4.230.0170.04318.80
5.4.220.0070.05318.94
5.4.210.0170.04318.84
5.4.200.0100.04718.71
5.4.190.0100.05018.88
5.4.180.0030.05318.98
5.4.170.0070.05318.75
5.4.160.0030.08018.97
5.4.150.0030.05718.69
5.4.140.0100.04716.31
5.4.130.0170.04716.49
5.4.120.0000.05316.58
5.4.110.0030.06016.52
5.4.100.0070.05716.37
5.4.90.0100.04716.34
5.4.80.0100.04316.51
5.4.70.0070.04716.42
5.4.60.0070.04716.31
5.4.50.0030.05016.29
5.4.40.0130.04716.48
5.4.30.0100.05316.44
5.4.20.0100.04716.48
5.4.10.0100.04716.48
5.4.00.0030.05316.00
5.3.280.0070.05014.51
5.3.270.0070.05314.60
5.3.260.0100.05014.68
5.3.250.0070.06014.60
5.3.240.0070.05314.83
5.3.230.0130.04314.44
5.3.220.0030.05714.57
5.3.210.0100.05314.58
5.3.200.0100.05014.41
5.3.190.0130.04714.65
5.3.180.0200.04014.66
5.3.170.0130.04314.75
5.3.160.0130.04314.72
5.3.150.0070.05714.66
5.3.140.0130.04014.74
5.3.130.0130.05014.55
5.3.120.0130.06014.64
5.3.110.0030.05314.64
5.3.100.0030.07013.88
5.3.90.0070.06014.19
5.3.80.0100.05014.11
5.3.70.0130.04313.93
5.3.60.0030.06014.09
5.3.50.0070.04713.96
5.3.40.0070.05313.86
5.3.30.0070.06714.14
5.3.20.0070.04713.78
5.3.10.0070.05313.73
5.3.00.0100.05013.67

preferences:
143.39 ms | 1394 KiB | 7 Q