3v4l.org

run code in 300+ PHP versions simultaneously
<?php function Query($str) { echo "$str\n"; } function Item_Search($AppID, $Keyword = '', $Wears) { // expected $Wears = [1,0,1,0,1] , numbers can be different from 0 to 1 $WearNames = ['red', 'green', 'blue', 'yellow', 'black']; $FinalWear = []; foreach ($Wears as $i => $Wear) { if ($Wear == 1) { $FinalWear[] = $WearNames[$i]; } } $FinalWear = "'" . implode("','", $FinalWear) . "'"; $EmptyWear = array_sum($Wears) == count($Wears) ? "OR wear = ''" : ''; $ItemList = Query(<<<EOD SELECT * FROM items WHERE appid=$AppID AND name LIKE '%$Keyword%' AND (wear IN ($FinalWear) $EmptyWear) EOD ); } Item_Search(4, 'shirt', [1, 0, 1, 0, 1]); Item_Search(13, 'shoe', [1, 1, 1, 1, 1]);

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.4.120.0100.01022.23
8.4.110.0100.00922.23
8.4.100.0090.00817.96
8.4.90.0140.00618.64
8.4.80.0090.00718.02
8.4.70.0120.01118.02
8.4.60.0110.00618.78
8.4.50.0120.00418.51
8.4.40.0200.00019.57
8.4.30.0160.00320.42
8.4.20.0160.00319.74
8.4.10.0040.00418.07
8.3.250.0100.00918.81
8.3.240.0100.00516.86
8.3.230.0100.00916.67
8.3.220.0100.00917.29
8.3.210.0110.01016.86
8.3.200.0140.00616.77
8.3.190.0040.00417.17
8.3.180.0120.00716.74
8.3.170.0110.00719.00
8.3.160.0170.00017.23
8.3.150.0080.01217.13
8.3.140.0060.00917.04
8.3.130.0030.00618.44
8.3.120.0030.00620.66
8.3.110.0060.00320.94
8.3.100.0090.00016.71
8.3.90.0040.00426.77
8.3.80.0090.00016.75
8.3.70.0210.00016.58
8.3.60.0110.00418.42
8.3.50.0070.00724.55
8.3.40.0080.01118.90
8.3.30.0040.01118.97
8.3.20.0040.00420.94
8.3.10.0070.00020.37
8.3.00.0040.00420.62
8.2.290.0090.00422.48
8.2.280.0080.01018.51
8.2.270.0150.00417.56
8.2.260.0130.00716.52
8.2.250.0080.00016.87
8.2.240.0040.00418.72
8.2.230.0050.00522.58
8.2.220.0050.00524.06
8.2.210.0040.01126.77
8.2.200.0030.00616.75
8.2.190.0120.00916.63
8.2.180.0110.00425.92
8.2.170.0150.00019.08
8.2.160.0110.00322.96
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0040.00421.11
8.2.110.0050.00519.18
8.2.100.0040.00818.03
8.2.90.0040.00417.75
8.2.80.0040.00418.73
8.2.70.0060.00317.75
8.2.60.0000.00818.04
8.2.50.0050.00318.07
8.2.40.0030.00620.09
8.2.30.0070.00018.04
8.2.20.0000.00718.07
8.2.10.0030.00518.98
8.2.00.0050.00319.38
8.1.330.0100.00821.96
8.1.320.0110.00916.22
8.1.310.0140.00418.41
8.1.300.0080.00020.43
8.1.290.0060.00318.88
8.1.280.0130.00325.92
8.1.270.0000.00824.66
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0050.00519.13
8.1.230.0070.00423.88
8.1.220.0040.00417.80
8.1.210.0000.00818.77
8.1.200.0000.00917.35
8.1.190.0000.00917.22
8.1.180.0000.00818.10
8.1.170.0030.00618.64
8.1.160.0000.00718.92
8.1.150.0000.00718.96
8.1.140.0040.00418.88
8.1.130.0000.00717.48
8.1.120.0030.00417.42
8.1.110.0050.00317.36
8.1.100.0000.00717.51
8.1.90.0000.00817.47
8.1.80.0000.00817.53
8.1.70.0000.00717.37
8.1.60.0030.00517.60
8.1.50.0000.00817.56
8.1.40.0030.00617.59
8.1.30.0040.00417.66
8.1.20.0000.00717.72
8.1.10.0080.00017.63
8.1.00.0050.00317.43
8.0.300.0000.00718.77
8.0.290.0040.00416.88
8.0.280.0030.00318.39
8.0.270.0060.00318.72
8.0.260.0040.00416.84
8.0.250.0000.00717.07
8.0.240.0030.00617.15
8.0.230.0070.00017.06
8.0.220.0070.00016.88
8.0.210.0000.00716.98
8.0.200.0050.00216.96
8.0.190.0000.00717.09
8.0.180.0000.01016.96
8.0.170.0060.00316.89
8.0.160.0100.00017.05
8.0.150.0040.00416.91
8.0.140.0000.00716.98
8.0.130.0000.00613.41
8.0.120.0000.00817.03
8.0.110.0040.00417.07
8.0.100.0080.00016.77
8.0.90.0000.00917.06
8.0.80.0080.00816.87
8.0.70.0040.00417.03
8.0.60.0040.00417.05
8.0.50.0050.00216.86
8.0.30.0120.00616.95
8.0.20.0090.00917.16
8.0.10.0040.00416.95
8.0.00.0090.00916.76
7.4.330.0000.00515.55
7.4.320.0060.00016.65
7.4.300.0030.00316.53
7.4.290.0040.00416.53
7.4.280.0070.00016.43
7.4.270.0030.00416.55
7.4.260.0040.00416.55
7.4.250.0000.00816.45
7.4.240.0020.00616.55
7.4.230.0040.00416.44
7.4.220.0020.00516.54
7.4.210.0090.00616.46
7.4.200.0030.00316.73
7.4.130.0160.00616.65
7.4.120.0100.01416.59
7.4.110.0030.01416.65
7.4.100.0070.01316.50
7.4.90.0080.00916.64
7.4.80.0130.00719.39
7.4.70.0110.00616.43
7.4.60.0070.01016.39
7.4.50.0120.00416.27
7.4.40.0060.01216.76
7.4.00.0080.00614.83
7.3.330.0050.00216.56
7.3.320.0000.00613.42
7.3.310.0040.00416.32
7.3.300.0040.00416.41
7.3.290.0090.00716.45
7.3.260.0110.00716.45
7.3.230.0150.00916.50
7.3.210.0070.01016.44
7.3.200.0070.01016.36
7.3.190.0100.00616.42
7.3.180.0060.01016.38
7.3.170.0030.01416.67
7.3.160.0090.01316.53
7.3.120.0120.00514.82
7.3.110.0040.01214.68
7.3.100.0040.01114.76
7.3.90.0060.00614.82
7.3.80.0090.00514.79
7.3.70.0060.00714.92
7.3.60.0050.00814.93
7.3.50.0100.00314.64
7.3.40.0040.00714.79
7.3.30.0080.00514.76
7.3.20.0050.00915.78
7.3.10.0120.00415.73
7.3.00.0070.00715.86
7.2.330.0090.01216.42
7.2.320.0030.01516.81
7.2.310.0150.00616.72
7.2.300.0070.01016.84
7.2.290.0150.00716.91
7.2.250.0110.00615.21
7.2.240.0090.00715.05
7.2.230.0060.00814.84
7.2.220.0030.01115.03
7.2.210.0060.00614.93
7.2.200.0070.00815.12
7.2.190.0030.00815.13
7.2.180.0070.00914.92
7.2.170.0050.00815.13
7.2.160.0110.00415.15
7.2.150.0140.00715.00
7.2.140.0120.00815.07
7.2.130.0160.00015.07
7.2.120.0070.00715.04
7.2.110.0100.00715.16
7.2.100.0000.01415.20
7.2.90.0130.00315.24
7.2.80.0030.01014.75
7.2.70.0130.00015.14
7.2.60.0110.00414.95
7.2.50.0070.00715.00
7.2.40.0030.01015.03
7.2.30.0090.00514.93
7.2.20.0110.01115.19
7.2.10.0040.01115.21
7.2.00.0120.00614.90
7.1.330.0060.00814.77
7.1.320.0090.00614.74
7.1.310.0020.01414.79
7.1.300.0070.00514.81
7.1.290.0080.00514.87
7.1.280.0030.00814.74
7.1.270.0050.00914.65
7.1.260.0030.01014.83
7.1.250.0070.00713.71

preferences:
29.5 ms | 403 KiB | 5 Q