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; } function getUserInfo($userName, $retrievables = "uid, user_bdate, user_from, uname, moody") { //$user = getUserID($userName); //$userID = (is_string($user) ? getUserID($user) : $user); //echo($userID); $query = buildQuery($retrievables, "usersTable", "", "uid=bla"); //echo($query); //$getUserInfo = mysql_query($query); //$gotUserInfo = mysql_fetch_array($getUserInfo); return $query; } print_r(getUserInfo("bla")); ?>

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.0130.00316.50
8.3.50.0210.00917.17
8.3.40.0160.00018.78
8.3.30.0090.00618.89
8.3.20.0080.00018.73
8.3.10.0040.00418.79
8.3.00.0030.00719.26
8.2.180.0120.00316.63
8.2.170.0090.00622.96
8.2.160.0090.00618.76
8.2.150.0030.00524.18
8.2.140.0060.00324.66
8.2.130.0090.00026.16
8.2.120.0000.00820.52
8.2.110.0030.00721.00
8.2.100.0030.00917.72
8.2.90.0060.00619.05
8.2.80.0030.00517.97
8.2.70.0040.00417.63
8.2.60.0090.00417.77
8.2.50.0000.00817.93
8.2.40.0080.00019.95
8.2.30.0000.00917.61
8.2.20.0120.00017.60
8.2.10.0000.00817.63
8.2.00.0080.00017.64
8.1.270.0080.00023.99
8.1.260.0050.00326.35
8.1.250.0070.00028.09
8.1.240.0030.00621.24
8.1.230.0070.00422.25
8.1.220.0040.00417.74
8.1.210.0000.00918.77
8.1.200.0030.00717.47
8.1.190.0040.00417.11
8.1.180.0080.00018.10
8.1.170.0080.00017.62
8.1.160.0000.00819.00
8.1.150.0070.00018.68
8.1.140.0000.00717.43
8.1.130.0040.00417.89
8.1.120.0000.00717.46
8.1.110.0030.00417.45
8.1.100.0040.00417.50
8.1.90.0040.00417.41
8.1.80.0000.00717.36
8.1.70.0000.00717.36
8.1.60.0040.00417.56
8.1.50.0080.00017.38
8.1.40.0000.00817.52
8.1.30.0080.00017.48
8.1.20.0060.00317.56
8.1.10.0040.00417.57
8.1.00.0040.00417.34
8.0.300.0000.00818.77
8.0.290.0040.00416.75
8.0.280.0070.00018.57
8.0.270.0030.00317.25
8.0.260.0030.00316.70
8.0.250.0030.00516.99
8.0.240.0110.00016.95
8.0.230.0030.00317.02
8.0.220.0070.00016.91
8.0.210.0000.00716.79
8.0.200.0030.00316.89
8.0.190.0030.00616.93
8.0.180.0000.00716.88
8.0.170.0030.00616.89
8.0.160.0000.00716.76
8.0.150.0030.00516.88
8.0.140.0000.01116.81
8.0.130.0030.00313.36
8.0.120.0060.00616.75
8.0.110.0000.00716.95
8.0.100.0040.00416.93
8.0.90.0030.00516.88
8.0.80.0060.00916.85
8.0.70.0070.00016.69
8.0.60.0040.00416.95
8.0.50.0040.00416.77
8.0.30.0100.00717.01
8.0.20.0140.00517.16
8.0.10.0070.00016.89
8.0.00.0050.01616.79
7.4.330.0050.00012.94
7.4.320.0030.00316.66
7.4.300.0000.00616.49
7.4.290.0030.00316.52
7.4.280.0000.00716.51
7.4.270.0030.00316.63
7.4.260.0000.00613.28
7.4.250.0040.00416.64
7.4.240.0030.00616.60
7.4.230.0050.00216.54
7.4.220.0060.01216.57
7.4.210.0090.00616.64
7.4.200.0030.00316.58
7.4.190.0040.00416.37
7.4.160.0060.00916.43
7.4.150.0070.01816.47
7.4.140.0060.01216.28
7.4.130.0060.01016.58
7.4.120.0130.00416.56
7.4.110.0060.01716.43
7.4.100.0110.00616.54
7.4.90.0030.01416.61
7.4.80.0070.01016.45
7.4.70.0030.01316.54
7.4.60.0030.01216.45
7.4.50.0050.00716.61
7.4.40.0100.00716.53
7.4.30.0130.00316.63
7.4.00.0030.01315.06
7.3.330.0000.00613.36
7.3.320.0080.00013.32
7.3.310.0030.00316.23
7.3.300.0030.00316.30
7.3.290.0080.00716.38
7.3.280.0080.00916.42
7.3.270.0070.01116.61
7.3.260.0120.00616.34
7.3.250.0090.01116.41
7.3.240.0070.01016.38
7.3.230.0110.00816.63
7.3.210.0130.00316.55
7.3.200.0130.00316.33
7.3.190.0130.00316.30
7.3.180.0090.01216.55
7.3.170.0090.00916.29
7.3.160.0160.00716.65
7.3.120.0080.00815.06
7.3.10.0040.00816.26
7.3.00.0040.01516.68
7.2.330.0100.01316.55
7.2.320.0130.00316.82
7.2.310.0110.01116.88
7.2.300.0110.00716.72
7.2.290.0120.00616.54
7.2.130.0080.00816.87
7.2.120.0100.00316.53
7.2.110.0060.00616.50
7.2.100.0090.00616.44
7.2.90.0070.00316.71
7.2.80.0040.00916.54
7.2.70.0090.00316.88
7.2.60.0130.00016.77
7.2.50.0030.01016.83
7.2.40.0040.00816.91
7.2.30.0030.01016.55
7.2.20.0060.00616.71
7.2.10.0000.01216.79
7.2.00.0070.00717.88
7.1.250.0040.00815.86
7.1.100.0030.00718.46
7.1.70.0060.00617.20
7.1.60.0100.01619.30
7.1.50.0100.01416.86
7.1.00.0000.06722.41
7.0.200.0090.00316.72
7.0.140.0030.07321.95
7.0.120.0030.07322.15
7.0.60.0100.08019.91
7.0.50.0130.05017.91
7.0.40.0000.09020.09
7.0.30.0400.05320.13
7.0.20.0230.07720.25
7.0.10.0170.08320.12
7.0.00.0100.05020.16
5.6.280.0070.07021.11
5.6.210.0130.06320.52
5.6.200.0030.07318.17
5.6.190.0070.03720.55
5.6.180.0270.03320.77
5.6.170.0270.06020.58
5.6.160.0100.03320.56
5.6.150.0030.08318.23
5.6.140.0100.06318.18
5.6.130.0170.03018.19
5.6.120.0130.08721.04
5.6.110.0030.05021.15
5.6.100.0100.07321.14
5.6.90.0070.06321.05
5.6.80.0030.03720.40
5.5.350.0200.08020.36
5.5.340.0100.03717.95
5.5.330.0070.04020.21
5.5.320.0300.08320.24
5.5.310.0330.07720.26
5.5.300.0070.05017.93
5.5.290.0130.04318.08
5.5.280.0130.05020.78
5.5.270.0070.07020.80
5.5.260.0100.08320.90
5.5.250.0070.08320.70
5.5.240.0000.07720.24
5.4.450.0100.08019.45
5.4.440.0130.04319.57
5.4.430.0030.04319.24
5.4.420.0030.08019.47
5.4.410.0070.04719.35
5.4.400.0070.07019.21
5.4.390.0070.04718.87
5.4.380.0130.04019.24
5.4.370.0030.08319.24
5.4.360.0070.07718.85
5.4.350.0100.06018.84
5.4.340.0100.05719.08
5.4.320.0070.05019.01
5.4.310.0030.07718.88
5.4.300.0100.07019.00
5.4.290.0070.08018.87
5.4.280.0130.03319.14
5.4.270.0070.03718.92
5.4.260.0070.03719.08
5.4.250.0130.05719.20
5.4.240.0030.06019.14
5.4.230.0100.07319.14
5.4.220.0070.04318.84
5.4.210.0170.03318.85
5.4.200.0030.04719.14
5.4.190.0130.03719.14
5.4.180.0070.03719.07
5.4.170.0070.05018.99
5.4.160.0070.04019.13
5.4.150.0100.04718.83
5.4.140.0000.04316.40
5.4.130.0070.05316.46
5.4.120.0000.04016.51
5.4.110.0030.04316.39
5.4.100.0030.05716.58
5.4.90.0130.06316.46
5.4.80.0030.07016.57
5.4.70.0000.04316.34
5.4.60.0000.06016.39
5.4.50.0100.06716.27
5.4.40.0070.04016.45
5.4.30.0030.07316.64
5.4.20.0100.06316.48
5.4.10.0030.06016.42
5.4.00.0030.03715.99
5.3.290.0030.05014.75
5.3.280.0130.04314.52
5.3.270.0100.03714.63
5.3.260.0000.04314.67
5.3.250.0030.08014.68
5.3.240.0070.03314.77
5.3.230.0070.07014.64
5.3.220.0070.03314.59
5.3.210.0030.04014.58
5.3.200.0070.08314.59
5.3.190.0030.07014.59
5.3.180.0030.07714.60
5.3.170.0030.07714.58
5.3.160.0070.07714.47
5.3.150.0130.06314.46
5.3.140.0130.06714.50
5.3.130.0000.07014.64
5.3.120.0030.08314.60
5.3.110.0130.07014.64
5.3.100.0000.08013.98
5.3.90.0000.04714.05
5.3.80.0030.03714.09
5.3.70.0070.04014.09
5.3.60.0070.03313.95
5.3.50.0070.07314.01
5.3.40.0030.07013.97
5.3.30.0030.05013.93
5.3.20.0130.03713.61
5.3.10.0070.04313.67
5.3.00.0000.06013.61
5.2.170.0000.03311.12
5.2.160.0030.03711.17
5.2.150.0070.03311.17
5.2.140.0030.04311.23
5.2.130.0070.06011.27
5.2.120.0000.03311.13
5.2.110.0070.06711.02
5.2.100.0000.03711.13
5.2.90.0030.06311.07
5.2.80.0100.06311.29
5.2.70.0100.05011.17
5.2.60.0070.03711.03
5.2.50.0030.04311.04
5.2.40.0000.03711.07
5.2.30.0030.04011.01
5.2.20.0030.03311.01
5.2.10.0030.05711.01
5.2.00.0100.03011.01
5.1.60.0030.05011.01
5.1.50.0000.06011.01
5.1.40.0000.04711.01
5.1.30.0070.03011.01
5.1.20.0030.05711.01
5.1.10.0000.03311.01
5.1.00.0000.06011.01
5.0.50.0030.02011.01
5.0.40.0030.04011.01
5.0.30.0030.04311.01
5.0.20.0070.02011.01
5.0.10.0030.02011.01
5.0.00.0000.03711.01
4.4.90.0000.02711.01
4.4.80.0000.03311.01
4.4.70.0000.02011.01
4.4.60.0030.03311.01
4.4.50.0030.02711.01
4.4.40.0030.05011.01
4.4.30.0070.02711.01
4.4.20.0000.02711.01
4.4.10.0000.01711.01
4.4.00.0000.03711.01
4.3.110.0000.03711.01
4.3.100.0100.01311.01
4.3.90.0030.01711.01
4.3.80.0000.02711.01
4.3.70.0070.02011.01
4.3.60.0030.03311.01
4.3.50.0000.02711.01
4.3.40.0070.02311.01
4.3.30.0000.02011.01
4.3.20.0030.02311.01
4.3.10.0000.03711.01
4.3.00.0000.03711.01

preferences:
39.05 ms | 400 KiB | 5 Q