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.00318.55
8.3.50.0100.00821.99
8.3.40.0060.00918.87
8.3.30.0110.00419.13
8.3.20.0080.00020.21
8.3.10.0080.00022.10
8.3.00.0000.00922.45
8.2.180.0040.01116.34
8.2.170.0040.01122.96
8.2.160.0150.00420.64
8.2.150.0060.00324.18
8.2.140.0000.00824.66
8.2.130.0040.01126.16
8.2.120.0060.00319.36
8.2.110.0070.00319.31
8.2.100.0120.00017.91
8.2.90.0080.00019.05
8.2.80.0000.00817.97
8.2.70.0090.00017.50
8.2.60.0000.00818.04
8.2.50.0060.00318.10
8.2.40.0040.00420.55
8.2.30.0040.00417.96
8.2.20.0000.00717.64
8.2.10.0000.00819.41
8.2.00.0000.00717.68
8.1.280.0120.00325.92
8.1.270.0060.00322.01
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0100.00021.27
8.1.230.0060.01018.95
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0090.00017.23
8.1.190.0030.00617.11
8.1.180.0040.00418.10
8.1.170.0070.00318.56
8.1.160.0040.00422.05
8.1.150.0020.00518.47
8.1.140.0000.00717.37
8.1.130.0040.00417.76
8.1.120.0030.00617.29
8.1.110.0030.00517.25
8.1.100.0000.00717.38
8.1.90.0040.00417.30
8.1.80.0070.00017.35
8.1.70.0000.00717.20
8.1.60.0040.00417.53
8.1.50.0030.00617.39
8.1.40.0060.00317.40
8.1.30.0030.00517.59
8.1.20.0030.00517.55
8.1.10.0030.00617.48
8.1.00.0040.00417.41
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0060.00318.38
8.0.270.0040.00417.20
8.0.260.0000.00816.81
8.0.250.0050.00316.95
8.0.240.0030.00316.93
8.0.230.0000.00816.99
8.0.220.0070.00016.76
8.0.210.0070.00016.80
8.0.200.0000.00716.91
8.0.190.0070.00416.99
8.0.180.0000.00716.88
8.0.170.0000.00916.94
8.0.160.0070.00016.95
8.0.150.0040.00416.85
8.0.140.0040.00416.71
8.0.130.0000.00613.29
8.0.120.0000.00816.81
8.0.110.0000.00716.82
8.0.100.0000.00717.00
8.0.90.0000.00717.00
8.0.80.0000.01616.80
8.0.70.0050.00316.88
8.0.60.0000.00716.77
8.0.50.0000.00716.87
8.0.30.0050.01417.12
8.0.20.0120.00717.40
8.0.10.0040.00417.05
8.0.00.0100.00816.52
7.4.330.0050.00015.00
7.4.320.0000.00616.29
7.4.300.0000.00616.39
7.4.290.0040.00416.51
7.4.280.0040.00416.55
7.4.270.0030.00316.45
7.4.260.0070.00016.29
7.4.250.0040.00416.55
7.4.240.0020.00516.45
7.4.230.0030.00316.34
7.4.220.0040.01316.57
7.4.210.0070.00916.45
7.4.200.0030.00416.34
7.4.190.0030.00516.61
7.4.160.0180.00316.32
7.4.150.0130.00317.40
7.4.140.0090.01217.86
7.4.130.0080.01116.51
7.4.120.0130.00516.53
7.4.110.0060.01816.29
7.4.100.0140.00316.41
7.4.90.0110.00716.41
7.4.80.0040.01419.39
7.4.70.0100.00616.50
7.4.60.0120.00616.43
7.4.50.0000.00816.47
7.4.40.0070.00422.77
7.4.30.0060.01016.26
7.4.00.0070.00714.82
7.3.330.0000.00513.32
7.3.320.0000.00613.31
7.3.310.0000.00716.26
7.3.300.0000.00716.19
7.3.290.0030.01116.28
7.3.280.0070.01016.32
7.3.270.0180.00017.40
7.3.260.0070.01316.68
7.3.250.0100.01216.33
7.3.240.0070.01016.52
7.3.230.0090.00916.51
7.3.210.0130.00316.29
7.3.200.0090.01219.39
7.3.190.0080.00816.60
7.3.180.0130.00316.39
7.3.170.0090.00616.42
7.3.160.0060.01016.35
7.3.120.0110.00614.87
7.3.10.0120.00616.36
7.3.00.0100.01016.27
7.2.330.0070.01016.42
7.2.320.0100.01416.49
7.2.310.0090.00616.54
7.2.300.0120.00916.41
7.2.290.0150.00616.56
7.2.130.0170.00316.73
7.2.120.0100.00716.62
7.2.110.0070.00716.82
7.2.100.0030.01016.68
7.2.90.0090.00616.73
7.2.80.0130.00716.68
7.2.70.0070.00716.74
7.2.60.0080.00816.46
7.2.50.0080.00716.68
7.2.40.0090.00616.70
7.2.30.0100.00616.64
7.2.20.0100.00316.84
7.2.10.0100.00716.59
7.2.00.0070.00716.77
7.1.250.0110.00715.52
7.1.240.0070.00715.57
7.1.230.0150.00615.69
7.1.220.0060.00615.17
7.1.210.0070.01015.27
7.1.200.0070.00515.47
7.1.190.0140.00415.60
7.1.180.0100.00315.69
7.1.170.0140.00315.71
7.1.160.0140.00315.36
7.1.150.0070.01015.60
7.1.140.0100.00715.51
7.1.130.0100.00315.54
7.1.120.0120.00615.55
7.1.110.0070.01015.71
7.1.100.0060.01015.72
7.1.90.0070.00715.62
7.1.80.0100.00315.43
7.1.70.0060.00416.24
7.1.60.0110.00316.28
7.1.50.0070.00516.16
7.1.40.0070.00715.62
7.1.30.0120.00315.56
7.1.20.0030.01015.37
7.1.10.0110.00315.41
7.1.00.0090.03918.93
7.0.330.0130.00315.13
7.0.320.0110.00715.12
7.0.310.0110.00715.18
7.0.300.0060.00615.28
7.0.290.0100.00715.40
7.0.280.0090.00615.05
7.0.270.0120.00315.36
7.0.260.0070.00715.34
7.0.250.0060.00915.43
7.0.240.0100.00715.25
7.0.230.0060.01015.20
7.0.220.0090.00615.41
7.0.210.0080.00815.29
7.0.200.0060.00816.04
7.0.190.0080.00815.02
7.0.180.0070.00715.36
7.0.170.0120.00415.40
7.0.160.0060.00615.16
7.0.150.0070.00715.26
7.0.140.0080.04018.62
7.0.130.0110.00415.11
7.0.120.0070.00715.30
7.0.110.0030.01015.20
7.0.100.0140.00315.27
7.0.90.0040.01215.38
7.0.80.0100.02917.67
7.0.70.0350.03317.57
7.0.60.0320.03317.58
7.0.50.0340.02617.76
7.0.40.0090.03216.65
7.0.30.0070.04316.49
7.0.20.0080.04316.61
7.0.10.0020.04616.76
7.0.00.0070.04016.70
5.6.380.0030.01013.90
5.6.370.0070.00314.22
5.6.360.0030.01313.91
5.6.350.0090.00614.01
5.6.340.0070.00314.06
5.6.330.0000.01514.11
5.6.320.0070.00714.16
5.6.310.0110.00414.07
5.6.300.0060.00614.12
5.6.290.0030.00914.30
5.6.280.0100.03517.29
5.6.270.0040.00814.02
5.6.260.0100.00013.59
5.6.250.0030.00613.95
5.6.240.0040.00814.12
5.6.230.0120.03917.39
5.6.220.0050.02417.42
5.6.210.0080.04017.29
5.6.200.0080.02917.63
5.6.190.0120.03717.45
5.6.180.0120.04317.50
5.6.170.0100.04117.38
5.6.160.0080.04317.47
5.6.150.0100.04017.37
5.6.140.0050.04717.42
5.6.130.0120.03817.51
5.6.120.0120.04217.67
5.6.110.0030.05217.54
5.6.100.0150.04017.46
5.6.90.0050.04417.55
5.6.80.0120.03317.21
5.6.70.0070.02917.12
5.6.60.0070.04217.28
5.6.50.0050.04617.09
5.6.40.0120.02517.18
5.6.30.0030.03817.30
5.6.20.0020.04917.33
5.6.10.0080.02317.24
5.6.00.0100.04217.16
5.5.380.0030.00610.86
5.5.370.0110.03315.59
5.5.360.0030.03115.73
5.5.350.0030.03315.75
5.5.340.0100.04015.91
5.5.330.0050.04315.87
5.5.320.0070.04515.76
5.5.310.0060.04215.91
5.5.300.0050.03215.73
5.5.290.0030.03016.01
5.5.280.0060.04115.96
5.5.270.0050.04315.87
5.5.260.0050.04015.94
5.5.250.0110.02015.74
5.5.240.0050.02915.48
5.5.230.0030.02815.31
5.5.220.0020.04215.60
5.5.210.0030.04015.62
5.5.200.0070.04115.63
5.5.190.0050.03215.66
5.5.180.0030.04615.40
5.5.170.0060.00610.91
5.5.160.0130.03015.45
5.5.150.0050.04515.55
5.5.140.0100.04015.49
5.5.130.0020.02815.39
5.5.120.0080.03815.39
5.5.110.0070.03515.41
5.5.100.0050.04015.43
5.5.90.0070.03715.27
5.5.80.0030.04415.29
5.5.70.0070.04215.51
5.5.60.0040.02515.37
5.5.50.0070.03515.46
5.5.40.0050.03815.50
5.5.30.0080.04115.51
5.5.20.0110.03515.49
5.5.10.0050.04015.59
5.5.00.0020.04215.42
5.4.450.0070.04515.29
5.4.440.0100.04215.15
5.4.430.0120.02815.13
5.4.420.0130.03715.12
5.4.410.0070.02715.14
5.4.400.0050.03914.64
5.4.390.0030.04514.85
5.4.380.0080.04014.95
5.4.370.0040.04014.62
5.4.360.0000.03814.85
5.4.350.0130.03615.01
5.4.340.0070.04214.86
5.4.330.0040.00810.88
5.4.320.0050.02515.06
5.4.310.0100.03714.88
5.4.300.0080.02514.91
5.4.290.0070.02915.00
5.4.280.0070.04314.94
5.4.270.0100.03814.88
5.4.260.0030.04214.85
5.4.250.0080.04114.67
5.4.240.0120.03514.71
5.4.230.0070.03714.79
5.4.220.0070.03515.00
5.4.210.0100.03914.96
5.4.200.0060.04014.94
5.4.190.0100.03714.75
5.4.180.0090.03814.86
5.4.170.0050.04514.84
5.4.160.0070.03915.00
5.4.150.0010.04714.99
5.4.140.0050.04013.62
5.4.130.0050.04013.62
5.4.120.0050.03813.61
5.4.110.0050.03913.73
5.4.100.0070.04213.55
5.4.90.0050.04113.70
5.4.80.0050.02713.64
5.4.70.0060.03513.56
5.4.60.0070.03413.52
5.4.50.0040.02313.57
5.4.40.0030.04013.73
5.4.30.0050.04013.71
5.4.20.0050.02013.59
5.4.10.0050.02113.47
5.4.00.0070.03313.11
5.3.290.0120.03812.63
5.3.280.0070.04312.53
5.3.270.0100.03812.60
5.3.260.0020.02912.61
5.3.250.0050.04012.54
5.3.240.0050.03512.38
5.3.230.0020.04412.39
5.3.220.0080.04012.57
5.3.210.0050.04212.50
5.3.200.0060.03012.64
5.3.190.0020.04312.53
5.3.180.0080.02812.58
5.3.170.0070.04012.58
5.3.160.0060.03912.54
5.3.150.0070.03112.55
5.3.140.0100.03712.45
5.3.130.0060.03812.69
5.3.120.0070.02612.51
5.3.110.0040.02212.51
5.3.100.0070.04012.34
5.3.90.0100.02612.33
5.3.80.0110.03712.16
5.3.70.0090.03512.26
5.3.60.0090.03412.27
5.3.50.0050.02912.24
5.3.40.0090.04012.26
5.3.30.0040.02712.27
5.3.20.0040.04212.09
5.3.10.0070.03712.07
5.3.00.0090.03811.99
5.2.170.0040.03911.17
5.2.160.0090.03411.17
5.2.150.0040.03711.17
5.2.140.0090.03111.17
5.2.130.0080.03211.17
5.2.120.0130.02711.17
5.2.110.0050.03711.17
5.2.100.0070.03011.17
5.2.90.0050.03311.17
5.2.80.0110.02911.17
5.2.70.0020.03511.17
5.2.60.0080.03211.17
5.2.50.0060.03011.17
5.2.40.0080.01711.17
5.2.30.0090.01711.17
5.2.20.0070.03411.17
5.2.10.0000.03711.17
5.2.00.0050.02011.17
5.1.60.0070.02611.17
5.1.50.0040.02411.17
5.1.40.0080.01611.17
5.1.30.0050.03211.17
5.1.20.0060.01811.17
5.1.10.0040.02311.17
5.1.00.0100.02511.17
5.0.50.0050.02511.17
5.0.40.0030.01911.17
5.0.30.0090.03011.17
5.0.20.0060.01111.17
5.0.10.0000.02811.17
5.0.00.0060.03011.17
4.4.90.0040.01911.17
4.4.80.0070.01511.17
4.4.70.0000.02211.17
4.4.60.0030.01911.17
4.4.50.0020.02111.17
4.4.40.0000.03411.17
4.4.30.0060.01011.17
4.4.20.0040.01611.17
4.4.10.0060.01911.17
4.4.00.0020.02211.17
4.3.110.0030.01811.17
4.3.100.0070.01211.17
4.3.90.0050.01811.17
4.3.80.0010.02011.17
4.3.70.0030.01811.17
4.3.60.0020.01511.17
4.3.50.0030.01311.17
4.3.40.0020.02811.17
4.3.30.0020.01211.17
4.3.20.0040.01311.17
4.3.10.0020.01511.17
4.3.00.0030.01211.17

preferences:
58.14 ms | 401 KiB | 5 Q