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 = "hereinafter"; $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.0090.01216.50
8.3.50.0070.01117.44
8.3.40.0080.00818.84
8.3.30.0140.00018.44
8.3.20.0080.00018.83
8.3.10.0000.00818.66
8.3.00.0040.00719.38
8.2.180.0100.00718.16
8.2.170.0070.00722.96
8.2.160.0080.00520.43
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0000.00726.16
8.2.120.0040.00419.77
8.2.110.0000.00920.47
8.2.100.0080.00317.78
8.2.90.0070.00020.61
8.2.80.0000.00818.73
8.2.70.0040.00417.48
8.2.60.0000.00818.16
8.2.50.0000.00918.05
8.2.40.0050.00318.03
8.2.30.0040.00418.08
8.2.20.0030.00517.75
8.2.10.0000.00717.71
8.2.00.0040.00417.61
8.1.280.0110.00725.92
8.1.270.0040.00423.75
8.1.260.0080.00026.35
8.1.250.0090.00028.09
8.1.240.0070.00322.25
8.1.230.0110.00022.16
8.1.220.0050.00317.79
8.1.210.0040.00418.77
8.1.200.0070.00317.23
8.1.190.0000.00817.35
8.1.180.0030.00618.10
8.1.170.0040.00418.50
8.1.160.0000.00719.06
8.1.150.0080.00018.69
8.1.140.0040.00417.53
8.1.130.0040.00417.38
8.1.120.0000.00717.46
8.1.110.0040.00417.49
8.1.100.0040.00417.46
8.1.90.0000.00717.36
8.1.80.0040.00417.47
8.1.70.0000.00717.37
8.1.60.0000.00817.65
8.1.50.0000.00817.51
8.1.40.0000.00817.41
8.1.30.0040.00417.58
8.1.20.0000.01117.57
8.1.10.0040.00417.48
8.1.00.0030.00617.41
8.0.300.0070.00018.77
8.0.290.0040.00716.63
8.0.280.0000.00718.56
8.0.270.0000.00818.07
8.0.260.0000.00618.37
8.0.250.0050.00516.90
8.0.240.0040.00416.87
8.0.230.0050.00316.97
8.0.220.0030.00316.91
8.0.210.0030.00316.89
8.0.200.0000.00716.85
8.0.190.0000.00816.91
8.0.180.0000.00716.99
8.0.170.0040.00416.92
8.0.160.0040.00416.97
8.0.150.0030.00616.79
8.0.140.0080.00016.75
8.0.130.0050.00013.37
8.0.120.0080.00016.82
8.0.110.0000.00716.73
8.0.100.0050.00316.77
8.0.90.0040.00416.96
8.0.80.0100.00616.87
8.0.70.0000.00816.70
8.0.60.0040.00416.74
8.0.50.0040.00416.78
8.0.30.0090.00917.19
8.0.20.0030.01617.05
8.0.10.0000.00716.87
8.0.00.0080.01716.82
7.4.330.0050.00012.93
7.4.320.0000.00716.51
7.4.300.0030.00316.51
7.4.290.0000.01116.46
7.4.280.0000.00716.43
7.4.270.0060.00016.41
7.4.260.0030.00313.29
7.4.250.0040.00416.46
7.4.240.0000.00716.57
7.4.230.0000.00716.40
7.4.220.0150.00916.53
7.4.210.0130.00316.48
7.4.200.0030.00316.59
7.4.190.0030.00616.77
7.4.160.0120.00916.45
7.4.150.0100.00716.57
7.4.140.0150.00317.86
7.4.130.0060.01316.38
7.4.120.0170.00616.47
7.4.110.0070.01016.59
7.4.100.0090.00916.69
7.4.90.0130.00816.38
7.4.80.0120.00717.42
7.4.70.0110.00816.53
7.4.60.0140.00516.40
7.4.50.0100.00716.43
7.4.40.0060.01216.41
7.4.30.0140.00516.54
7.4.20.0090.01216.45
7.4.10.0120.00916.36
7.4.00.0080.01116.04
7.3.330.0030.00313.34
7.3.320.0080.00013.33
7.3.310.0000.00816.36
7.3.300.0030.00316.39
7.3.290.0050.01116.34
7.3.280.0080.00816.28
7.3.270.0070.01016.29
7.3.260.0070.01016.44
7.3.240.0120.00416.39
7.3.230.0120.01216.33
7.3.210.0130.00716.28
7.3.200.0110.00916.35
7.3.190.0100.01016.46
7.3.180.0110.00616.38
7.3.170.0110.00916.33
7.3.160.0110.01016.41
7.3.150.0110.01216.62
7.3.140.0150.00616.36
7.3.130.0120.00816.33
7.3.120.0070.01315.98
7.3.110.0100.00915.88
7.3.100.0120.00715.88
7.3.90.0080.01015.75
7.3.80.0080.01315.99
7.3.70.0130.00915.88
7.3.60.0140.00915.74
7.3.50.0150.00715.71
7.3.40.0140.00915.86
7.3.30.0110.01215.83
7.3.20.0120.00916.42
7.3.10.0100.01016.51
7.3.00.0180.00616.55
7.2.330.0110.01016.55
7.2.320.0110.01016.62
7.2.310.0080.01216.50
7.2.300.0100.01216.71
7.2.290.0060.01316.62
7.2.280.0130.00916.49
7.2.270.0020.01816.81
7.2.260.0140.00916.71
7.2.250.0110.01316.65
7.2.240.0070.01216.33
7.2.230.0120.01016.26
7.2.220.0070.01216.16
7.2.210.0170.00716.17
7.2.200.0140.00915.99
7.2.190.0140.00916.11
7.2.180.0150.00816.19
7.2.170.0130.00916.18
7.2.160.0180.00716.10
7.2.150.0100.01516.72
7.2.140.0120.00916.82
7.2.130.0160.00716.80
7.2.120.0100.01316.84
7.2.110.0140.00916.81
7.2.100.0170.00716.76
7.2.90.0150.00916.68
7.2.80.0140.01016.74
7.2.70.0170.00916.74
7.2.60.0120.00816.91
7.2.50.0140.01216.75
7.2.40.0140.01116.85
7.2.30.0350.00616.77
7.2.20.0120.01316.86
7.2.10.0160.00816.76
7.2.00.0100.01116.70
7.1.330.0130.01015.66
7.1.320.0190.00815.68
7.1.310.0170.01015.71
7.1.300.0240.00415.82
7.1.290.0230.00515.69
7.1.280.0120.01715.72
7.1.270.0300.00615.66
7.1.260.0160.00915.79
7.1.250.0150.01015.69
7.1.240.0330.00715.61
7.1.230.0260.01315.60
7.1.220.0230.00815.64
7.1.210.0210.00815.68
7.1.200.0270.00615.69
7.1.190.0230.01015.53
7.1.180.0230.01215.62
7.1.170.0220.00715.59
7.1.160.0230.01015.60
7.1.150.0270.00915.66
7.1.140.0280.01015.61
7.1.130.0250.00815.60
7.1.120.0250.00615.56
7.1.110.0320.00415.66
7.1.100.0180.00816.38
7.1.90.0250.00615.75
7.1.80.0160.01315.60
7.1.70.0160.00616.25
7.1.60.0180.01116.85
7.1.50.0150.01216.00
7.1.40.0220.00715.84
7.1.30.0290.00215.64
7.1.20.0220.00815.80
7.1.10.0190.01015.67
7.1.00.0170.02717.86
7.0.330.0270.00515.36
7.0.320.0180.00815.27
7.0.310.0220.00715.19
7.0.300.0200.01315.29
7.0.290.0220.01215.29
7.0.280.0300.00415.26
7.0.270.0240.01015.39
7.0.260.0210.00915.23
7.0.250.0200.01115.32
7.0.240.0150.01415.32
7.0.230.0180.01015.43
7.0.220.0190.00815.36
7.0.210.0190.00915.43
7.0.200.0160.00515.86
7.0.190.0280.00515.25
7.0.180.0200.00615.33
7.0.170.0180.01215.40
7.0.160.0210.00615.36
7.0.150.0270.00815.32
7.0.140.0110.03417.52
7.0.130.0160.01115.26
7.0.120.0120.03117.55
7.0.110.0230.00515.20
7.0.100.0210.00815.36
7.0.90.0210.00915.41
7.0.80.0150.01215.32
7.0.70.0200.01015.25
7.0.60.0190.01816.91
7.0.50.0120.01716.06
7.0.40.0110.02016.88
7.0.30.0250.02316.92
7.0.20.0180.02316.89
7.0.10.0120.02316.89
7.0.00.0160.03216.96
5.6.400.0250.01215.89
5.6.390.0250.00716.07
5.6.380.0170.01615.82
5.6.370.0170.01215.86
5.6.360.0230.00915.88
5.6.350.0260.01016.11
5.6.340.0230.01816.13
5.6.330.0240.01015.78
5.6.320.0150.01416.04
5.6.310.0140.01516.01
5.6.300.0160.01816.02
5.6.290.0130.01416.02
5.6.280.0170.03017.76
5.6.270.0210.01015.88
5.6.260.0220.01415.86
5.6.250.0190.01215.94
5.6.240.0240.01015.95
5.6.230.0220.00815.98
5.6.220.0200.01015.89
5.6.210.0140.02417.47
5.6.200.0150.02016.68
5.6.190.0220.02917.61
5.6.180.0270.03117.40
5.6.170.0220.03617.44
5.6.160.0130.02717.45
5.6.150.0190.03016.64
5.6.140.0150.03416.75
5.6.130.0140.03516.66
5.6.120.0140.03317.64
5.6.110.0140.03217.64
5.6.100.0190.03017.78
5.6.90.0180.02317.56
5.6.80.0130.03417.56
5.6.70.0240.00715.79
5.6.60.0200.01115.88
5.6.50.0210.00815.98
5.6.40.0180.01115.84
5.6.30.0180.01315.84
5.6.20.0190.01115.96
5.6.10.0220.00915.83
5.6.00.0190.01015.83
5.5.380.0250.00715.98
5.5.370.0180.01115.81
5.5.360.0260.00716.00
5.5.350.0260.03017.46
5.5.340.0150.02516.65
5.5.330.0220.03017.40
5.5.320.0230.02217.51
5.5.310.0270.03417.43
5.5.300.0140.02916.65
5.5.290.0170.03416.69
5.5.280.0140.02417.57
5.5.270.0170.02117.64
5.5.260.0160.03517.62
5.5.250.0210.02817.48
5.5.240.0120.03517.30
5.5.230.0180.01215.93
5.5.220.0190.01215.86
5.5.210.0220.01015.84
5.5.200.0260.00715.96
5.5.190.0170.01315.89
5.5.180.0200.01315.86
5.5.170.0210.01215.85
5.5.160.0200.00815.94
5.5.150.0260.00615.93
5.5.140.0190.01315.89
5.5.130.0220.00915.99
5.5.120.0170.01215.90
5.5.110.0250.01315.86
5.5.100.0200.01315.89
5.5.90.0170.01215.89
5.5.80.0210.01015.85
5.5.70.0160.01315.86
5.5.60.0220.01215.92
5.5.50.0190.01315.90
5.5.40.0180.01415.88
5.5.30.0210.00915.77
5.5.20.0270.00815.83
5.5.10.0190.01215.74
5.5.00.0180.01015.86
5.4.450.0140.01815.00
5.4.440.0150.02314.93
5.4.430.0130.02814.91
5.4.420.0140.02014.98
5.4.410.0130.02015.01
5.4.400.0170.02015.02
5.4.390.0160.02914.90
5.4.380.0120.02414.89
5.4.370.0110.02414.77
5.4.360.0150.02014.84
5.4.350.0160.01514.77
5.4.340.0110.03814.82
5.4.330.0150.01112.79
5.4.320.0130.02714.93
5.4.310.0120.02714.74
5.4.300.0140.03014.95
5.4.290.0110.02914.74
5.4.280.0130.02914.84
5.4.270.0120.02214.88
5.4.260.0140.02814.81
5.4.250.0160.02014.96
5.4.240.0150.01614.88
5.4.230.0130.01614.89
5.4.220.0140.02414.77
5.4.210.0150.03014.80
5.4.200.0170.02114.88
5.4.190.0150.03014.91
5.4.180.0100.02214.84
5.4.170.0110.02914.73
5.4.160.0130.02614.92
5.4.150.0110.02014.80
5.4.140.0130.01713.87
5.4.130.0130.01914.13
5.4.120.0090.02714.10
5.4.110.0150.01913.94
5.4.100.0180.02714.04
5.4.90.0120.02414.04
5.4.80.0110.02214.06
5.4.70.0120.02614.08
5.4.60.0120.02614.10
5.4.50.0080.03414.01
5.4.40.0120.01913.94
5.4.30.0090.02213.96
5.4.20.0090.02914.00
5.4.10.0100.03113.92
5.4.00.0130.02313.83
5.3.290.0100.03313.75
5.3.280.0070.02713.59
5.3.270.0110.02013.61
5.3.260.0140.01813.63
5.3.250.0170.02213.67
5.3.240.0150.02913.63
5.3.230.0120.02613.72
5.3.220.0120.02213.57
5.3.210.0160.02513.51
5.3.200.0160.02813.68
5.3.190.0140.02513.64
5.3.180.0130.01913.66
5.3.170.0090.03613.62
5.3.160.0120.02313.61
5.3.150.0140.02013.63
5.3.140.0140.02813.61
5.3.130.0150.03013.57
5.3.120.0110.03513.52
5.3.110.0090.02813.57
5.3.100.0090.03413.53
5.3.90.0110.02513.39
5.3.80.0110.02613.26
5.3.70.0140.01913.41
5.3.60.0110.02513.34
5.3.50.0130.02213.29
5.3.40.0120.02213.38
5.3.30.0120.03113.39
5.3.20.0150.02613.34
5.3.10.0140.02213.18
5.3.00.0120.02313.20
5.2.170.0140.01112.20
5.2.160.0130.00712.08
5.2.150.0070.01412.10
5.2.140.0110.01112.12
5.2.130.0090.00911.95
5.2.120.0060.01211.98
5.2.110.0150.00412.13
5.2.100.0120.00812.14
5.2.90.0150.00612.05
5.2.80.0150.00612.05
5.2.70.0160.00612.02
5.2.60.0170.00411.95
5.2.50.0100.01012.10
5.2.40.0130.00512.06
5.2.30.0130.00512.13
5.2.20.0150.00311.91
5.2.10.0060.01111.64
5.2.00.0150.00311.79
5.1.60.0130.00311.18
5.1.50.0070.01011.18
5.1.40.0140.00311.18
5.1.30.0100.00711.30
5.1.20.0100.00711.24
5.1.10.0100.00711.18
5.1.00.0100.00711.18
5.0.50.0090.00611.18
5.0.40.0070.01111.18
5.0.30.0110.00311.18
5.0.20.0140.00011.18
5.0.10.0040.00911.18
5.0.00.0030.01111.18
4.4.90.0070.00411.18
4.4.80.0100.00011.18
4.4.70.0090.00011.18
4.4.60.0040.00411.18
4.4.50.0050.00511.18
4.4.40.0100.00011.18
4.4.30.0070.00311.18
4.4.20.0070.00211.18
4.4.10.0090.00011.18
4.4.00.0070.00511.18
4.3.110.0070.00411.18
4.3.100.0030.00611.18
4.3.90.0090.00011.18
4.3.80.0060.00311.18
4.3.70.0050.00511.18
4.3.60.0070.00211.18
4.3.50.0090.00011.18
4.3.40.0040.00411.18
4.3.30.0050.00211.18
4.3.20.0070.00311.18
4.3.10.0070.00011.18
4.3.00.0070.00011.18

preferences:
48.52 ms | 401 KiB | 5 Q