3v4l.org

run code in 300+ PHP versions simultaneously
<?php function buildQuery($retrievables, $table, $conditions = "", $limit = 0, $order = "") { $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 // 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 = ["userID", "userName", "userAge", "userLocation", "userSex", "userIntention", "usersTable"]; $realValues = ["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 = ["articleID", "articleTitle", "articleLeadingText", "articleBodyText"]; $realValues = ["sid", "title", "hometext", "bodytext"]; break; default: $realValues = []; } // we then replace $niceValues with $realValues $modifiedQuery = str_ireplace($niceValues, $realValues, $query); return $modifiedQuery; } print_r(buildQuery("userID, userAge, userSex", "usersTable", 10)); ?>

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.0110.00416.75
8.3.50.0110.00916.44
8.3.40.0090.00618.59
8.3.30.0110.00418.71
8.3.20.0040.00418.60
8.3.10.0050.00318.54
8.3.00.0100.00019.13
8.2.180.0140.00717.99
8.2.170.0090.00622.96
8.2.160.0100.01018.97
8.2.150.0000.00724.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0060.00319.50
8.2.110.0070.00320.38
8.2.100.0080.00417.84
8.2.90.0000.00817.75
8.2.80.0060.00318.79
8.2.70.0060.00317.63
8.2.60.0000.00817.93
8.2.50.0000.00818.05
8.2.40.0040.00419.48
8.2.30.0060.00317.79
8.2.20.0060.00317.77
8.2.10.0040.00417.69
8.2.00.0080.00017.89
8.1.280.0100.00725.92
8.1.270.0090.00024.66
8.1.260.0000.01026.35
8.1.250.0040.00428.09
8.1.240.0070.00323.70
8.1.230.0040.00820.88
8.1.220.0040.00417.78
8.1.210.0040.00418.77
8.1.200.0060.00317.48
8.1.190.0000.00917.35
8.1.180.0040.00418.10
8.1.170.0050.00317.62
8.1.160.0000.00818.97
8.1.150.0000.00718.55
8.1.140.0050.00317.52
8.1.130.0000.00717.53
8.1.120.0040.00417.55
8.1.110.0080.00017.53
8.1.100.0030.00417.51
8.1.90.0040.00317.49
8.1.80.0000.00817.33
8.1.70.0000.00717.51
8.1.60.0040.00417.63
8.1.50.0030.00617.51
8.1.40.0000.00817.62
8.1.30.0030.00617.70
8.1.20.0040.00417.72
8.1.10.0000.00717.49
8.1.00.0040.00417.50
8.0.300.0040.00418.77
8.0.290.0030.00616.75
8.0.280.0040.00418.54
8.0.270.0000.00717.37
8.0.260.0030.00316.85
8.0.250.0080.00017.05
8.0.240.0050.00217.00
8.0.230.0030.00616.94
8.0.220.0070.00016.85
8.0.210.0070.00016.93
8.0.200.0000.00617.01
8.0.190.0070.00017.01
8.0.180.0040.00416.96
8.0.170.0080.00016.98
8.0.160.0040.00416.98
8.0.150.0000.00816.88
8.0.140.0030.00616.93
8.0.130.0050.00013.34
8.0.120.0030.00716.79
8.0.110.0030.00316.93
8.0.100.0000.00717.00
8.0.90.0000.00716.75
8.0.80.0030.01316.95
8.0.70.0000.00816.85
8.0.60.0030.00616.82
8.0.50.0060.00316.80
8.0.30.0030.01317.33
8.0.20.0110.00817.03
8.0.10.0040.00416.93
8.0.00.0130.01016.84
7.4.330.0020.00213.05
7.4.320.0030.00316.54
7.4.300.0000.00616.43
7.4.290.0070.00316.56
7.4.280.0070.00016.64
7.4.270.0030.00316.68
7.4.260.0000.00513.24
7.4.250.0060.00316.63
7.4.240.0080.00016.70
7.4.230.0000.00716.63
7.4.220.0090.01616.60
7.4.210.0040.01216.68
7.4.200.0040.00416.53
7.4.190.0030.00516.50
7.4.160.0040.01216.46
7.4.150.0100.00716.48
7.4.140.0120.00617.86
7.4.130.0160.00316.44
7.4.120.0130.01116.59
7.4.110.0120.00916.52
7.4.100.0100.00716.64
7.4.90.0060.01116.51
7.4.80.0090.01319.39
7.4.70.0030.01316.60
7.4.60.0110.00416.56
7.4.50.0030.00616.42
7.4.40.0090.00616.39
7.4.30.0090.00816.69
7.4.00.0060.00914.89
7.3.330.0000.00613.35
7.3.320.0000.00513.24
7.3.310.0070.00016.30
7.3.300.0030.00316.31
7.3.290.0070.00916.38
7.3.280.0110.00416.30
7.3.270.0070.01016.26
7.3.260.0070.01116.30
7.3.240.0120.00916.43
7.3.230.0070.01016.32
7.3.210.0100.00616.43
7.3.200.0160.00716.64
7.3.190.0130.00316.60
7.3.180.0100.00616.53
7.3.170.0160.00316.35
7.3.160.0100.00716.54
7.3.120.0060.01014.79
7.3.110.0090.00614.50
7.3.100.0100.00314.86
7.3.90.0000.01414.72
7.3.80.0060.00714.32
7.3.70.0080.00414.80
7.3.60.0000.00814.95
7.3.50.0040.00814.98
7.3.40.0100.00314.84
7.3.30.0030.00714.64
7.3.20.0030.00616.62
7.3.10.0070.00716.56
7.3.00.0070.00716.53
7.2.330.0120.00616.73
7.2.320.0140.00916.88
7.2.310.0100.00716.49
7.2.300.0130.00316.48
7.2.290.0150.00716.45
7.2.240.0030.01015.25
7.2.230.0030.01015.02
7.2.220.0150.00414.79
7.2.210.0000.01314.77
7.2.200.0040.00414.80
7.2.190.0030.00715.09
7.2.180.0060.00615.19
7.2.170.0110.00314.78
7.2.160.0060.00914.91
7.2.150.0000.01016.94
7.2.140.0120.00017.09
7.2.130.0020.01216.99
7.2.120.0080.00716.88
7.2.110.0100.00416.82
7.2.100.0090.00316.85
7.2.90.0090.00616.87
7.2.80.0050.00916.84
7.2.70.0080.00916.89
7.2.60.0100.00616.97
7.2.50.0090.00916.88
7.2.40.0080.00916.92
7.2.30.0090.00616.83
7.2.20.0070.00816.98
7.2.10.0110.00716.79
7.2.00.0070.00817.57
7.1.330.0110.00415.91
7.1.320.0030.00715.58
7.1.310.0040.00415.52
7.1.300.0040.00715.52
7.1.290.0030.01015.79
7.1.280.0040.01215.75
7.1.270.0100.00315.95
7.1.260.0030.00515.92
7.1.250.0100.00515.57
7.1.100.0110.01517.87
7.1.70.0000.01217.34
7.1.60.0070.01719.25
7.1.50.0090.00917.02
7.1.00.0000.07322.35
7.0.200.0030.00516.76
7.0.140.0100.06722.00
7.0.120.0070.03321.93
7.0.60.0230.07020.01
7.0.50.0130.06717.89
7.0.40.0070.08720.23
7.0.30.0370.06020.23
7.0.20.0270.05720.16
7.0.10.0170.07020.25
7.0.00.0130.03720.27
5.6.280.0030.07321.12
5.6.210.0130.06720.74
5.6.200.0030.06318.25
5.6.190.0030.04720.79
5.6.180.0070.04020.48
5.6.170.0200.04020.47
5.6.160.0070.04018.22
5.6.150.0070.07718.18
5.6.140.0030.04018.12
5.6.130.0070.08018.17
5.6.120.0200.07321.03
5.6.110.0170.07321.14
5.6.100.0000.04321.13
5.6.90.0100.06721.08
5.6.80.0130.05720.55
5.5.350.0130.08320.33
5.5.340.0070.07718.07
5.5.330.0030.04320.25
5.5.320.0270.06020.20
5.5.310.0170.05020.30
5.5.300.0030.07717.98
5.5.290.0100.07717.99
5.5.280.0070.05720.75
5.5.270.0030.04320.89
5.5.260.0070.04720.78
5.5.250.0130.07720.56
5.5.240.0230.07720.05
5.4.450.0000.09319.34
5.4.440.0100.07719.56
5.4.430.0000.04719.24
5.4.420.0030.05719.46
5.4.410.0130.07319.34
5.4.400.0030.04319.26
5.4.390.0000.04719.14
5.4.380.0070.04018.87
5.4.370.0100.03319.24
5.4.360.0100.05719.28
5.4.350.0100.07019.20
5.4.340.0070.05019.15
5.4.320.0000.04319.14
5.4.310.0070.07719.12
5.4.300.0030.07019.24
5.4.290.0100.06718.87
5.4.280.0100.07019.11
5.4.270.0070.04019.20
5.4.260.0070.07019.14
5.4.250.0070.04019.14
5.4.240.0100.05019.07
5.4.230.0100.07719.04
5.4.220.0100.07718.84
5.4.210.0070.06319.20
5.4.200.0070.07318.97
5.4.190.0100.06318.96
5.4.180.0070.04018.96
5.4.170.0070.07318.99
5.4.160.0000.04719.13
5.4.150.0100.06718.94
5.4.140.0070.04016.38
5.4.130.0000.04016.32
5.4.120.0070.03316.44
5.4.110.0100.03016.41
5.4.100.0000.04316.53
5.4.90.0030.03716.29
5.4.80.0070.03016.29
5.4.70.0000.03716.28
5.4.60.0030.03716.27
5.4.50.0030.03716.64
5.4.40.0000.04016.27
5.4.30.0100.03316.38
5.4.20.0030.03316.36
5.4.10.0070.03316.46
5.4.00.0000.03715.84
5.3.290.0070.03714.82
5.3.280.0070.04714.66
5.3.270.0070.04014.62
5.3.260.0070.08014.67
5.3.250.0030.07714.60
5.3.240.0030.04314.75
5.3.230.0030.04314.52
5.3.220.0100.05714.58
5.3.210.0000.04014.58
5.3.200.0070.03314.64
5.3.190.0000.04714.63
5.3.180.0070.03314.71
5.3.170.0000.04014.57
5.3.160.0030.03714.57
5.3.150.0070.04014.45
5.3.140.0000.04014.71
5.3.130.0030.03714.55
5.3.120.0070.03314.55
5.3.110.0070.03314.55
5.3.100.0000.04014.04
5.3.90.0030.03314.09
5.3.80.0070.03314.07
5.3.70.0070.03314.03
5.3.60.0070.03314.06
5.3.50.0000.04013.96
5.3.40.0030.03713.87
5.3.30.0070.03713.94
5.3.20.0000.03713.68
5.3.10.0000.04013.60
5.3.00.0030.03313.70
5.2.170.0070.02711.32
5.2.160.0030.02711.15
5.2.150.0000.03011.11
5.2.140.0070.02711.07
5.2.130.0030.02711.00
5.2.120.0030.02711.14
5.2.110.0000.03011.03
5.2.100.0030.02711.18
5.2.90.0070.02311.18
5.2.80.0000.03311.09
5.2.70.0030.02711.16
5.2.60.0030.02711.11
5.2.50.0000.03010.98
5.2.40.0000.03010.96
5.2.30.0030.02710.97
5.2.20.0030.02711.11
5.2.10.0000.03010.82
5.2.00.0100.02710.69
5.1.60.0030.05310.06
5.1.50.0030.0279.99
5.1.40.0030.0309.97
5.1.30.0070.05310.35
5.1.20.0130.02710.35
5.1.10.0030.03010.04
5.1.00.0000.06010.04
5.0.50.0030.0438.54
5.0.40.0030.0378.32
5.0.30.0070.0338.38
5.0.20.0030.0438.11
5.0.10.0000.0338.16
5.0.00.0070.0308.14
4.4.90.0000.0138.08
4.4.80.0000.0138.08
4.4.70.0000.0178.08
4.4.60.0000.0178.08
4.4.50.0000.0138.08
4.4.40.0000.0538.08
4.4.30.0000.0178.08
4.4.20.0030.0308.08
4.4.10.0000.0378.08
4.4.00.0000.0578.08
4.3.110.0070.0178.08
4.3.100.0000.0308.08
4.3.90.0000.0278.08
4.3.80.0000.0538.08
4.3.70.0000.0378.08
4.3.60.0000.0308.08
4.3.50.0030.0378.08
4.3.40.0070.0378.08
4.3.30.0000.0408.08
4.3.20.0000.0208.08
4.3.10.0000.0338.08
4.3.00.0000.0338.08

preferences:
51.82 ms | 401 KiB | 5 Q