3v4l.org

run code in 300+ PHP versions simultaneously
<?php function buildQuery($retrievables, $table, $limit = 0, $conditions = "", $orderCondition = "", $orderDirection = "") { $query = "SELECT $retrievables FROM $table"; // if we have conditions - add them to the query $query .= ($conditions != "" ? " WHERE " . $conditions : ""); // if we have a limit - add it to the query $query .= ($limit != 0 ? " LIMIT " . $limit : ""); // if we have to order the results - add it to the query $query .= ($orderCondition != "" ? " ORDER BY " . $orderCondition . " " . $orderDirection : ""); // first we create a "dictionary" which translates $niceValues that are used throughout the code // to $realValues which are used in the MySQL database // since the $realValues are different in every table - we must account to that switch ($table) { case 'usersTable': $niceValues = array("userID", "userName", "userAge", "userLocation", "userSex", "userIntention", "usersTable"); $realValues = array("uid", "uname", "user_bdate", "user_from", "name", "user_intrest", "nuke_users"); // yeah - the field "name" is really the sex of the user break; case 'articlesTable': $niceValues = array("articleID", "articleTitle", "articleLead", "articleBody", "articlesTable"); $realValues = array("sid", "title", "hometext", "bodytext", "nuke_stories"); break; default: $realValues = array(); } // we then replace $niceValues with $realValues $modifiedQuery = str_ireplace($niceValues, $realValues, $query); return $modifiedQuery; } $user = 155566; $userID = (is_string($user) ? 145554 : $user); $retrievables = "uid, user_bdate, user_from, uname, moody"; print_r(buildQuery($retrievables, "usersTable", "", "uid=$userID")); ?>

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.0070.01418.43
8.3.50.0130.00821.99
8.3.40.0150.00618.61
8.3.30.0040.01818.57
8.3.20.0080.00018.78
8.3.10.0050.00321.05
8.3.00.0040.00421.85
8.2.180.0180.00316.63
8.2.170.0100.01022.96
8.2.160.0170.00320.39
8.2.150.0070.00725.66
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0000.00821.05
8.2.110.0030.00622.20
8.2.100.0120.00018.03
8.2.90.0000.00817.69
8.2.80.0060.00317.97
8.2.70.0090.00517.63
8.2.60.0050.00318.05
8.2.50.0040.00418.07
8.2.40.0080.00018.28
8.2.30.0070.00019.32
8.2.20.0030.00617.79
8.2.10.0040.00417.69
8.2.00.0000.01017.63
8.1.280.0140.00725.92
8.1.270.0050.00323.99
8.1.260.0120.00626.35
8.1.250.0000.00728.09
8.1.240.0030.00723.85
8.1.230.0080.00320.89
8.1.220.0050.00317.79
8.1.210.0040.00418.88
8.1.200.0060.00317.23
8.1.190.0030.00617.51
8.1.180.0080.00018.10
8.1.170.0030.00618.58
8.1.160.0040.00418.89
8.1.150.0090.00018.66
8.1.140.0070.00017.33
8.1.130.0080.00017.83
8.1.120.0000.00717.38
8.1.110.0080.00017.50
8.1.100.0040.00417.48
8.1.90.0000.00717.52
8.1.80.0030.00317.43
8.1.70.0080.00017.43
8.1.60.0050.00517.61
8.1.50.0040.00417.51
8.1.40.0040.00417.43
8.1.30.0040.00417.67
8.1.20.0040.00417.65
8.1.10.0030.00617.47
8.1.00.0070.00017.34
8.0.300.0000.00719.90
8.0.290.0050.00317.15
8.0.280.0070.00018.38
8.0.270.0040.00417.13
8.0.260.0070.00016.83
8.0.250.0000.00716.86
8.0.240.0030.00616.89
8.0.230.0000.00716.82
8.0.220.0030.00316.77
8.0.210.0000.00716.92
8.0.200.0040.00416.94
8.0.190.0040.00416.85
8.0.180.0040.00416.93
8.0.170.0030.00516.95
8.0.160.0040.00417.01
8.0.150.0000.00716.91
8.0.140.0050.00316.84
8.0.130.0000.00513.33
8.0.120.0040.00416.89
8.0.110.0020.00516.89
8.0.100.0000.00716.78
8.0.90.0040.00416.76
8.0.80.0070.01016.91
8.0.70.0030.00516.77
8.0.60.0000.00716.89
8.0.50.0050.00216.89
8.0.30.0140.00517.11
8.0.20.0110.01217.40
8.0.10.0040.00416.89
8.0.00.0090.01016.62
7.4.330.0000.00616.89
7.4.320.0060.00316.54
7.4.300.0070.00016.61
7.4.290.0040.00416.58
7.4.280.0070.00016.42
7.4.270.0070.00016.52
7.4.260.0060.00013.33
7.4.250.0080.00016.40
7.4.240.0030.00316.50
7.4.230.0030.00316.45
7.4.220.0040.01416.59
7.4.210.0060.01016.52
7.4.200.0000.00716.61
7.4.190.0030.00516.77
7.4.160.0080.00816.42
7.4.150.0100.01617.40
7.4.140.0080.00917.86
7.4.130.0080.01516.53
7.4.120.0190.00216.56
7.4.110.0110.00516.34
7.4.100.0130.01016.59
7.4.90.0130.00516.60
7.4.80.0070.01019.39
7.4.70.0070.01016.52
7.4.60.0100.01016.62
7.4.50.0060.00316.45
7.4.40.0060.00622.77
7.4.30.0180.00316.63
7.4.00.0100.00615.19
7.3.330.0000.00613.35
7.3.320.0050.00013.31
7.3.310.0040.00416.42
7.3.300.0070.00016.24
7.3.290.0100.00716.38
7.3.280.0060.01016.34
7.3.270.0150.00417.40
7.3.260.0120.00718.24
7.3.250.0070.01016.43
7.3.240.0090.00816.36
7.3.230.0110.00616.39
7.3.210.0080.00816.29
7.3.200.0080.00819.39
7.3.190.0130.01016.64
7.3.180.0040.01116.62
7.3.170.0150.00316.52
7.3.160.0090.01216.53
7.3.120.0070.00715.12
7.3.10.0060.00816.80
7.3.00.0030.01016.89
7.2.330.0070.01016.54
7.2.320.0120.00616.83
7.2.310.0150.00916.84
7.2.300.0060.01616.71
7.2.290.0070.01016.63
7.2.130.0060.00316.98
7.2.120.0120.00616.69
7.2.110.0000.01317.05
7.2.100.0040.00416.74
7.2.90.0060.00617.04
7.2.80.0040.00416.95
7.2.70.0000.01317.04
7.2.60.0060.00917.04
7.2.50.0100.00716.95
7.2.40.0090.00316.99
7.2.30.0100.00717.02
7.2.20.0000.01117.04
7.2.10.0070.00716.72
7.2.00.0060.00618.20
7.1.250.0080.00415.77
7.1.100.0070.00718.33
7.1.70.0070.00316.96
7.1.60.0040.00717.23
7.1.50.0100.01016.93
7.1.00.0030.03722.42
7.0.200.0110.00016.93
7.0.140.0000.07722.21
7.0.100.0100.08020.00
7.0.90.0130.07319.96
7.0.80.0130.07720.07
7.0.70.0230.07020.06
7.0.60.0070.07720.00
7.0.50.0170.05320.35
7.0.40.0030.07020.05
7.0.30.0100.08020.14
7.0.20.0130.06720.03
7.0.10.0070.04720.18
7.0.00.0100.04320.03
5.6.280.0070.07020.92
5.6.250.0000.06020.83
5.6.240.0170.07320.71
5.6.230.0070.04720.69
5.6.220.0130.09020.69
5.6.210.0100.08020.68
5.6.200.0100.08321.05
5.6.190.0100.07321.18
5.6.180.0030.08321.06
5.6.170.0070.05021.18
5.6.160.0130.07021.03
5.6.150.0030.08721.18
5.6.140.0000.06321.04
5.6.130.0130.07320.94
5.6.120.0030.07321.12
5.6.110.0130.08021.05
5.6.100.0070.04021.17
5.6.90.0100.08021.02
5.6.80.0030.06720.42
5.6.70.0100.08320.40
5.6.60.0100.07320.42
5.6.50.0170.06020.51
5.6.40.0070.04320.43
5.6.30.0100.04320.39
5.6.20.0070.06720.30
5.6.10.0100.08020.32
5.6.00.0100.08020.31
5.5.380.0130.06720.41
5.5.370.0030.08720.38
5.5.360.0070.06320.46
5.5.350.0200.06720.40
5.5.340.0130.09020.81
5.5.330.0200.05320.90
5.5.320.0130.06720.91
5.5.310.0070.07720.88
5.5.300.0070.08320.73
5.5.290.0070.05720.88
5.5.280.0070.07320.74
5.5.270.0130.06020.74
5.5.260.0030.06320.89
5.5.250.0030.06020.46
5.5.240.0100.07320.29
5.5.230.0230.04320.29
5.5.220.0130.07720.25
5.5.210.0070.07720.25
5.5.200.0230.03020.14
5.5.190.0100.04320.10
5.5.180.0130.08320.27
5.5.160.0070.08320.24
5.5.150.0030.06020.13
5.5.140.0070.04020.13
5.5.130.0030.06320.15
5.5.120.0100.04320.22
5.5.110.0070.09319.98
5.5.100.0130.07320.10
5.5.90.0070.07320.05
5.5.80.0030.05720.17
5.5.70.0100.04020.06
5.5.60.0170.06320.09
5.5.50.0100.04320.11
5.5.40.0030.07320.04
5.5.30.0100.06720.06
5.5.20.0070.07720.06
5.5.10.0070.04319.99
5.5.00.0030.06720.13
5.4.450.0070.04719.23
5.4.440.0030.07319.56
5.4.430.0030.08319.48
5.4.420.0070.04019.45
5.4.410.0000.08319.35
5.4.400.0030.06318.85
5.4.390.0070.08019.05
5.4.380.0130.04719.09
5.4.370.0070.08018.96
5.4.360.0130.07019.09
5.4.350.0130.06719.21
5.4.340.0030.05719.03
5.4.320.0030.08319.14
5.4.310.0100.07318.95
5.4.300.0070.06319.04
5.4.290.0130.06319.03
5.4.280.0030.04719.02
5.4.270.0130.07018.92
5.4.260.0100.07018.87
5.4.250.0030.04719.13
5.4.240.0030.08319.02
5.4.230.0100.05019.08
5.4.220.0000.08319.20
5.4.210.0000.08019.17
5.4.200.0070.07719.14
5.4.190.0000.08319.01
5.4.180.0130.04019.03
5.4.170.0000.07719.03
5.4.160.0030.05019.21
5.4.150.0200.06718.83
5.4.140.0030.07016.41
5.4.130.0030.07316.40
5.4.120.0100.05716.32
5.4.110.0070.03716.61
5.4.100.0030.04016.39
5.4.90.0030.03716.51
5.4.80.0070.05316.26
5.4.70.0130.05016.49
5.4.60.0070.08316.48
5.4.50.0100.07016.34
5.4.40.0070.07316.46
5.4.30.0070.07016.40
5.4.20.0100.06316.33
5.4.10.0100.06316.36
5.4.00.0130.07015.80
5.3.290.0070.04314.69
5.3.280.0000.07314.61
5.3.270.0070.06314.62
5.3.260.0030.07714.69
5.3.250.0030.08714.74
5.3.240.0170.05014.54
5.3.230.0100.07014.66
5.3.220.0070.07714.65
5.3.210.0030.04714.54
5.3.200.0070.04314.57
5.3.190.0070.03714.67
5.3.180.0030.05314.69
5.3.170.0030.04014.61
5.3.160.0130.07014.72
5.3.150.0030.04014.70
5.3.140.0070.05714.54
5.3.130.0100.07314.60
5.3.120.0070.08314.49
5.3.110.0070.07714.56
5.3.100.0100.07014.11
5.3.90.0130.06014.10
5.3.80.0030.08014.12
5.3.70.0030.04313.92
5.3.60.0070.04014.09
5.3.50.0070.05313.89
5.3.40.0000.07314.02
5.3.30.0100.06313.83
5.3.20.0000.07713.84
5.3.10.0000.04013.76
5.3.00.0130.06313.68
5.2.170.0070.06311.17
5.2.160.0100.03011.04
5.2.150.0130.06011.28
5.2.140.0000.07011.04
5.2.130.0070.06311.21
5.2.120.0030.05011.23
5.2.110.0070.05311.04
5.2.100.0100.03011.02
5.2.90.0070.03311.21
5.2.80.0000.03311.02
5.2.70.0070.02311.25
5.2.60.0100.03011.05
5.2.50.0000.06311.07
5.2.40.0030.05010.89
5.2.30.0030.04010.85
5.2.20.0030.03311.03
5.2.10.0070.06310.88
5.2.00.0000.06310.80
5.1.60.0130.02010.48
5.1.50.0100.04010.48
5.1.40.0030.04310.48
5.1.30.0070.04310.48
5.1.20.0070.05310.48
5.1.10.0030.03310.48
5.1.00.0030.04710.48
5.0.50.0030.03710.48
5.0.40.0070.04310.48
5.0.30.0000.06710.48
5.0.20.0000.05010.48
5.0.10.0100.04010.48
5.0.00.0030.05710.48
4.4.90.0030.03710.48
4.4.80.0030.03010.48
4.4.70.0100.02010.48
4.4.60.0030.03710.48
4.4.50.0030.03710.48
4.4.40.0030.05310.48
4.4.30.0100.01710.48
4.4.20.0000.03310.48
4.4.10.0000.03010.48
4.4.00.0000.05310.48
4.3.110.0030.03710.48
4.3.100.0030.03010.48
4.3.90.0070.02710.48
4.3.80.0000.03010.48
4.3.70.0000.02010.48
4.3.60.0000.03010.48
4.3.50.0000.01710.48
4.3.40.0000.05010.48
4.3.30.0000.03310.48
4.3.20.0070.01710.48
4.3.10.0000.03710.48
4.3.00.0000.02710.48

preferences:
43.65 ms | 401 KiB | 5 Q