3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getWordsWithOnlySpecifedLetters(array $dictionary, $letters) { $strSplit = preg_split('//u', $letters, null, PREG_SPLIT_NO_EMPTY); $strSplitLower = array_map('mb_strtolower', $strSplit); sort($strSplit); $result = []; foreach ($dictionary as $word) { if(mb_strlen($word) <= mb_strlen($letters)) { $wordSplit = preg_split('//u', $word, null, PREG_SPLIT_NO_EMPTY); sort($wordSplit); if (array_map('mb_strtolower', $wordSplit) === $strSplitLower) { $result[] = $word; } } } return $result; } $dictionary = ['apple', 'sample', 'api', 'pia', 'тоҷик']; echo '<pre>' . print_r(getWordsWithOnlySpecifedLetters($dictionary, "aip"), true) . '</pre>';

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.0130.00417.13
8.3.60.0090.00918.93
8.3.50.0100.01018.45
8.3.40.0040.01219.14
8.3.30.0120.00318.82
8.3.20.0090.00320.77
8.3.10.0070.00021.81
8.3.00.0050.00519.69
8.2.190.0110.00416.58
8.2.180.0200.00016.88
8.2.170.0090.00622.96
8.2.160.0040.01119.46
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00421.06
8.2.110.0050.00520.93
8.2.100.0060.00618.09
8.2.90.0050.00318.28
8.2.80.0040.00418.22
8.2.70.0090.00017.88
8.2.60.0040.00417.88
8.2.50.0000.00817.88
8.2.40.0080.00019.70
8.2.30.0080.00019.53
8.2.20.0090.00218.15
8.2.10.0000.00718.14
8.2.00.0070.00019.56
8.1.280.0120.00925.92
8.1.270.0080.00023.82
8.1.260.0000.00826.35
8.1.250.0000.00828.09
8.1.240.0080.00022.14
8.1.230.0040.00720.97
8.1.220.0040.00417.76
8.1.210.0090.00019.12
8.1.200.0040.00417.48
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0000.00817.68
8.1.160.0040.00419.03
8.1.150.0000.00718.88
8.1.140.0050.00217.75
8.1.130.0030.00518.98
8.1.120.0050.00217.57
8.1.110.0030.00617.61
8.1.100.0000.00817.69
8.1.90.0070.00017.69
8.1.80.0040.00417.71
8.1.70.0040.00417.55
8.1.60.0080.00017.70
8.1.50.0080.00017.70
8.1.40.0000.00817.78
8.1.30.0040.00417.82
8.1.20.0000.00717.89
8.1.10.0080.00017.75
8.1.00.0030.00517.57
8.0.300.0040.00420.03
8.0.290.0040.00416.88
8.0.280.0030.00318.46
8.0.270.0000.00717.34
8.0.260.0030.00317.38
8.0.250.0000.00717.10
8.0.240.0030.00317.15
8.0.230.0030.00717.18
8.0.220.0030.00617.15
8.0.210.0070.00017.12
8.0.200.0070.00017.25
8.0.190.0060.00317.10
8.0.180.0030.00517.22
8.0.170.0090.00417.24
8.0.160.0020.00517.22
8.0.150.0050.00316.99
8.0.140.0040.00417.07
8.0.130.0000.00513.61
8.0.120.0050.00217.16
8.0.110.0030.00617.11
8.0.100.0000.00716.99
8.0.90.0050.00216.98
8.0.80.0050.01217.15
8.0.70.0040.00417.18
8.0.60.0040.00417.05
8.0.50.0040.00417.15
8.0.30.0080.01117.22
8.0.20.0100.00917.40
8.0.10.0000.00717.01
8.0.00.0130.01116.92
7.4.330.0050.00015.55
7.4.320.0060.00016.90
7.4.300.0000.00616.78
7.4.290.0000.00716.77
7.4.280.0030.00516.67
7.4.270.0070.00016.75
7.4.260.0070.00016.89
7.4.250.0000.00716.75
7.4.240.0000.00716.92
7.4.230.0040.00416.80
7.4.220.0080.00016.92
7.4.210.0120.00616.87
7.4.200.0000.00716.85
7.4.160.0100.00616.70
7.4.140.0090.00917.86
7.4.130.0070.01116.80
7.4.120.0110.01016.69
7.4.110.0090.01316.92
7.4.100.0090.00816.70
7.4.90.0070.01116.56
7.4.80.0090.01519.39
7.4.70.0140.00316.76
7.4.60.0100.00716.56
7.4.50.0130.00316.74
7.4.40.0090.00916.82
7.4.00.0070.01014.96
7.3.330.0000.00513.46
7.3.320.0030.00313.41
7.3.310.0030.00316.67
7.3.300.0070.00016.65
7.3.290.0030.00316.46
7.3.280.0090.00716.65
7.3.260.0140.00816.58
7.3.240.0080.01016.67
7.3.230.0090.00916.59
7.3.210.0130.00316.67
7.3.200.0150.00316.62
7.3.190.0110.01216.49
7.3.180.0160.00616.44
7.3.170.0100.00616.88
7.3.160.0080.00816.53
7.2.330.0030.01516.70
7.2.320.0170.00016.94
7.2.310.0040.01316.90
7.2.300.0140.00317.03
7.2.290.0140.01017.01
7.2.60.0030.00717.33
7.2.40.0120.01620.07
7.2.30.0040.01120.33
7.2.20.0050.01319.87
7.2.10.0100.00619.85
7.2.00.0050.01120.22
7.1.200.0000.01215.92
7.1.160.0110.00718.93
7.1.150.0060.00918.78
7.1.140.0080.00818.77
7.1.130.0080.00919.11
7.1.120.0090.00718.76
7.1.110.0080.00918.23
7.1.100.0080.00718.49
7.1.90.0070.01318.48
7.1.80.0080.01418.57
7.1.70.0040.01017.50
7.1.60.0240.00935.20
7.1.50.0240.00835.04
7.1.40.0210.01334.83
7.1.30.0240.01334.94
7.1.20.0260.01134.99
7.1.10.0080.00917.14
7.1.00.0060.01317.04

preferences:
47.28 ms | 401 KiB | 5 Q