3v4l.org

run code in 300+ PHP versions simultaneously
<?php function detectGender($keyword) { $gender = 0; $genderKeywords = [ 'MY' => [ 1 => 'men,male', 2 => 'women,female', ], 'SG' => [ 1 => 'men,male', 2 => 'women,female', ], 'HK' => [ 1 => 'men,male', 2 => 'women,female', ], 'PH' => [ 1 => 'men,male', 2 => 'women,female', ], 'TH' => [ 1 => 'ชาย,ผชาย', 2 => 'หญง,ผหญง', ], 'VN' => [ 1 => 'nam', 2 => 'nu', ], 'ID' => [ 1 => 'pria', 2 => 'wanita', ], ]; foreach ($genderKeywords['VN'] as $key => $keywords) { if (array_search($keyword, explode(',', $keywords)) !== false) { return $key; } } return $gender; } for ($i = 0; $i < 20000; $i++) { print_r(detectGender('nam')); }

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.70.0470.01316.63
8.3.60.0350.01118.43
8.3.50.0380.01616.50
8.3.40.0360.01718.71
8.3.30.0300.02018.54
8.3.20.0170.01021.85
8.3.10.0190.00923.64
8.3.00.0190.00923.52
8.2.180.0350.01316.42
8.2.170.0330.01322.96
8.2.160.0460.01320.30
8.2.150.0100.01924.18
8.2.140.0270.00324.66
8.2.130.0140.01419.38
8.2.120.0210.00726.35
8.2.110.0200.01720.94
8.2.100.0300.00717.91
8.2.90.0100.01017.84
8.2.80.0100.01018.24
8.2.70.0130.01017.63
8.2.60.0130.01317.63
8.2.50.0100.01018.16
8.2.40.0100.01020.42
8.2.30.0110.01120.69
8.2.20.0070.01418.18
8.2.10.0100.01318.11
8.2.00.0130.01018.03
8.1.280.0320.01325.92
8.1.270.0180.00623.83
8.1.260.0240.00726.35
8.1.250.0200.01028.09
8.1.240.0170.01722.48
8.1.230.0260.01620.98
8.1.220.0140.00717.74
8.1.210.0070.01418.77
8.1.200.0120.00917.23
8.1.190.0100.01017.21
8.1.180.0150.00718.10
8.1.170.0030.01718.37
8.1.160.0100.01318.77
8.1.150.0100.01022.09
8.1.140.0070.01317.57
8.1.130.0130.00717.36
8.1.120.0090.01617.46
8.1.110.0110.01117.37
8.1.100.0100.01317.50
8.1.90.0160.00617.45
8.1.80.0040.01817.45
8.1.70.0130.00917.34
8.1.60.0030.02117.59
8.1.50.0070.01417.50
8.1.40.0040.01817.50
8.1.30.0100.01417.56
8.1.20.0160.00617.61
8.1.10.0070.01617.37
8.1.00.0060.01617.43
8.0.300.0100.01019.89
8.0.290.0040.01816.75
8.0.280.0040.01818.44
8.0.270.0160.00617.14
8.0.260.0100.01016.73
8.0.250.0090.01216.80
8.0.240.0060.01616.85
8.0.230.0070.01416.88
8.0.220.0070.01416.90
8.0.210.0100.01016.76
8.0.200.0090.01316.96
8.0.190.0120.00916.96
8.0.180.0150.00816.79
8.0.170.0100.01316.96
8.0.160.0060.01616.89
8.0.150.0090.01216.85
8.0.140.0030.01716.73
8.0.130.0100.01013.32
8.0.120.0100.01316.88
8.0.110.0140.01416.78
8.0.100.0100.01016.88
8.0.90.0100.01016.93
8.0.80.0240.04816.89
8.0.70.0110.01116.85
8.0.60.0030.01616.68
8.0.50.0100.01316.91
8.0.30.0590.03417.01
8.0.20.0630.04317.40
8.0.10.0130.00716.86
8.0.00.0690.04616.93
7.4.330.0120.00615.55
7.4.320.0110.01116.51
7.4.300.0070.01316.42
7.4.290.0110.01116.58
7.4.280.0060.01516.55
7.4.270.0130.01316.61
7.4.260.0040.01816.64
7.4.250.0040.01916.56
7.4.240.0170.00716.49
7.4.230.0120.01216.68
7.4.220.0060.01316.70
7.4.210.0330.05916.51
7.4.200.0140.00716.40
7.4.160.0790.04116.56
7.4.140.1450.08817.86
7.4.130.0770.09416.66
7.4.120.0610.05816.53
7.4.110.0610.04716.40
7.4.100.0500.05616.47
7.4.90.0490.04916.71
7.4.80.0900.08419.39
7.4.70.0560.03016.45
7.4.60.0290.05616.49
7.4.50.0300.01116.45
7.4.40.0520.04916.23
7.4.10.0370.02714.94
7.4.00.0230.03114.96
7.3.330.0070.01113.21
7.3.320.0030.01613.18
7.3.310.0100.01016.28
7.3.300.0070.01116.36
7.3.290.0100.01016.37
7.3.280.0330.04916.29
7.3.260.0940.06016.43
7.3.250.0600.05316.55
7.3.240.0730.06016.43
7.3.230.0760.05316.60
7.3.210.0750.06316.67
7.3.200.0830.08616.61
7.3.190.0520.05216.47
7.3.180.0520.05216.46
7.3.170.0770.04216.27
7.3.160.0260.06216.58
7.3.130.0320.03214.70
7.3.120.0340.03114.53
7.3.110.0250.04314.92
7.3.100.0400.01714.91
7.3.90.0320.01914.75
7.3.80.0270.03015.02
7.3.70.0260.02614.73
7.3.60.0210.02714.85
7.3.50.0230.02914.77
7.3.40.0180.03514.73
7.3.30.0310.01914.93
7.3.20.0270.02016.55
7.3.10.0410.01716.80
7.3.00.0290.02916.48
7.2.330.0770.06716.75
7.2.320.0590.05916.71
7.2.310.0390.07416.68
7.2.300.0750.08616.47
7.2.290.0370.05616.86
7.2.260.0220.04115.19
7.2.250.0260.04215.37
7.2.240.0240.02715.02
7.2.230.0160.03914.76
7.2.220.0230.02914.96
7.2.210.0240.02415.15
7.2.200.0160.02915.00
7.2.190.0210.03115.21
7.2.180.0350.02215.20
7.2.170.0200.03715.19
7.2.160.0240.02414.89
7.2.150.0420.02617.06
7.2.140.0190.03216.97
7.2.130.0330.03016.93
7.2.120.0200.04016.86
7.2.110.0130.03616.94
7.2.100.0220.02917.01
7.2.90.0340.02717.11
7.2.80.0400.02317.15
7.2.70.0290.01616.91
7.2.60.0230.02617.02
7.2.50.0240.03717.09
7.2.40.0270.03317.11
7.2.30.0430.03717.53
7.2.20.0440.04717.34
7.2.10.0380.04517.44
7.2.00.0450.02617.52
7.1.330.0160.03915.71
7.1.320.0370.02715.97
7.1.310.0230.02715.95
7.1.300.0200.02915.77
7.1.290.0220.03515.92
7.1.280.0290.03215.99
7.1.270.0200.03315.83
7.1.260.0320.03515.83
7.1.250.0100.05215.90
7.1.240.0360.01615.65
7.1.230.0260.02315.84
7.1.220.0300.02615.92
7.1.210.0300.03715.96
7.1.200.0310.01615.79
7.1.190.0390.02615.91
7.1.180.0450.02115.62
7.1.170.0220.03815.91
7.1.160.0260.03915.97
7.1.150.0380.05016.29
7.1.140.0410.04516.40
7.1.130.0420.03916.41
7.1.120.0490.03416.34
7.1.110.0470.04316.00
7.1.100.0410.04816.11
7.1.90.0460.04916.06
7.1.80.0440.04416.13
7.1.70.0350.04515.63
7.1.60.0580.04424.66
7.1.50.0500.03924.45
7.1.40.0510.04924.24
7.1.30.0560.04624.29
7.1.20.0640.04624.44
7.1.10.0350.04915.41
7.1.00.0440.04415.45
7.0.330.0270.04115.37
7.0.320.0360.03315.38
7.0.310.0310.03815.38
7.0.300.0410.02415.46
7.0.290.0200.04215.46
7.0.280.0380.02815.41
7.0.270.0230.03915.33
7.0.260.0170.04415.02
7.0.250.0270.03715.60
7.0.240.0390.01915.38
7.0.230.0350.02615.50
7.0.220.0200.03615.25
7.0.210.0240.04115.55
7.0.200.0290.03615.56
7.0.190.0230.03715.59
7.0.180.0310.03715.33
7.0.170.0260.03515.58
7.0.160.0370.02015.50
7.0.150.0140.04115.43
7.0.140.0240.03415.45
7.0.130.0340.03415.61
7.0.120.0300.03715.05
7.0.110.0340.03715.54
7.0.100.0130.04015.27
7.0.90.0330.03315.49
7.0.80.0240.04515.11
7.0.70.0360.02615.54
7.0.60.0270.04015.37
7.0.50.0340.03415.44
7.0.40.0330.03613.61
7.0.30.0280.02813.52
7.0.20.0350.03113.52
7.0.10.0260.03913.36
7.0.00.0390.02613.48
5.6.400.0500.09714.73
5.6.390.0300.08814.34
5.6.380.0400.09914.52
5.6.370.0270.10714.77
5.6.360.0260.08914.42
5.6.350.0310.10014.57
5.6.340.0420.08114.68
5.6.330.0200.10814.13
5.6.320.0260.09914.54
5.6.310.0300.09014.38
5.6.300.0330.08714.20
5.6.290.0480.09214.45
5.6.280.0330.10314.46
5.6.270.0300.10414.05
5.6.260.0370.09314.80
5.6.250.0360.10714.33
5.6.240.0240.11914.29
5.6.230.0340.09814.63
5.6.220.0330.10914.31
5.6.210.0290.10814.51
5.6.200.0470.09014.20
5.6.190.0360.09914.22
5.6.180.0200.11514.13
5.6.170.0300.10614.39
5.6.160.0340.10214.48
5.6.150.0360.11014.15
5.6.140.0400.10714.24
5.6.130.0330.12214.60
5.6.120.0400.10914.44
5.6.110.0420.09814.11
5.6.100.0440.10114.27
5.6.90.0330.11414.52
5.6.80.0420.10014.51
5.6.70.0390.11114.38
5.6.60.0330.11014.50
5.6.50.0440.09414.32
5.6.40.0160.11814.50
5.6.30.0360.09614.09
5.6.20.0390.09814.31
5.6.10.0360.09514.17
5.6.00.0270.09314.19

preferences:
50.49 ms | 401 KiB | 5 Q