3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(-1); mb_internal_encoding('utf-8'); $text = "ну что. не смотрел еще black mesa.я собирался скачать ,но все как-то некогда было."; // Для тестов // $text = 'roses are red,and violets are blue.whatever you do i'll keep it for you.'; // $text = 'привет.есть 2 функции,preg_split и explode ,не понимаю,в чем между ними разница.'; /* Делает первую букву в строке заглавной */ function makeFirstLetterUppercase($text) { $sentences = preg_split("/(?<=[!\?\.])/u", $text, -1, PREG_SPLIT_NO_EMPTY); $countSentences = count($sentences); for ($i = 0; $i < $countSentences; $i++){ $sentences[1] = trim($sentences[1]); $sentences[$i] = mb_ucfirst($sentences[$i]); } $text=implode($sentences); return($text); } function mb_ucfirst($str, $encoding = NULL) { if($encoding === NULL) { $encoding = mb_internal_encoding(); } return mb_substr(mb_strtoupper($str, $encoding), 0, 1, $encoding) . mb_substr($str, 1, mb_strlen($str)-1, $encoding); } /* исправляет текст */ function fixText($text) { $patterns=array(); $patterns[1]='/(\\s+)?,(\\s+)?/u'; $patterns[2]='/[.]/u'; $replacements=array(); $replacements[1]=", "; $replacements[2]=". "; $text=preg_replace($patterns,$replacements,$text); return($text); } function ucfirst_utf8($str) { return mb_substr(mb_strtoupper($str, 'utf-8'), 0, 1, 'utf-8') . mb_substr($str, 1, mb_strlen($str)-1, 'utf-8'); } $text = makeFirstLetterUppercase($text); //$result = fixText($text); echo "{$text}\n";

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.0070.01417.13
8.3.50.0110.00418.42
8.3.40.0110.00419.04
8.3.30.0150.00418.92
8.3.20.0170.00020.34
8.3.10.0000.00821.95
8.3.00.0080.00023.65
8.2.180.0070.00718.54
8.2.170.0140.00722.96
8.2.160.0110.00419.50
8.2.150.0000.00725.66
8.2.140.0060.00324.66
8.2.130.0070.00022.21
8.2.120.0080.00026.35
8.2.110.0070.00319.20
8.2.100.0090.00318.01
8.2.90.0080.00019.21
8.2.80.0000.00817.97
8.2.70.0060.00317.75
8.2.60.0030.00618.03
8.2.50.0000.00818.10
8.2.40.0030.00522.40
8.2.30.0000.00719.34
8.2.20.0040.00418.06
8.2.10.0000.00818.26
8.2.00.0000.00718.36
8.1.280.0110.00425.92
8.1.270.0040.00420.71
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0060.00324.00
8.1.230.0090.00617.82
8.1.220.0050.00317.91
8.1.210.0050.00318.77
8.1.200.0090.00017.60
8.1.190.0000.00917.60
8.1.180.0050.00318.10
8.1.170.0040.00422.11
8.1.160.0040.00418.98
8.1.150.0040.00420.32
8.1.140.0060.00319.71
8.1.130.0000.00719.06
8.1.120.0040.00417.78
8.1.110.0000.00817.74
8.1.100.0030.00517.69
8.1.90.0040.00417.62
8.1.80.0000.00817.60
8.1.70.0030.00317.73
8.1.60.0040.00417.80
8.1.50.0080.00017.82
8.1.40.0000.00817.72
8.1.30.0030.00617.91
8.1.20.0040.00417.97
8.1.10.0000.00817.82
8.1.00.0000.00817.65
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0000.00818.52
8.0.270.0030.00317.46
8.0.260.0070.00017.37
8.0.250.0000.00717.26
8.0.240.0020.00517.29
8.0.230.0070.00017.11
8.0.220.0030.00517.22
8.0.210.0000.00717.22
8.0.200.0030.00317.33
8.0.190.0040.00417.20
8.0.180.0000.00817.28
8.0.170.0040.00417.10
8.0.160.0000.00717.11
8.0.150.0040.00417.10
8.0.140.0000.00717.18
8.0.130.0000.00513.64
8.0.120.0070.00017.18
8.0.110.0030.00517.19
8.0.100.0000.00717.07
8.0.90.0030.00517.27
8.0.80.0150.00017.16
8.0.70.0070.00017.07
8.0.60.0040.00417.11
8.0.50.0040.00417.27
8.0.30.0080.01217.39
8.0.20.0110.00817.53
8.0.10.0000.00817.20
8.0.00.0090.00917.20
7.4.330.0020.00215.55
7.4.320.0000.00816.80
7.4.300.0000.00616.73
7.4.290.0030.00316.91
7.4.280.0030.00616.72
7.4.270.0000.00716.74
7.4.260.0000.01016.80
7.4.250.0050.00316.86
7.4.240.0040.00416.85
7.4.230.0030.00416.83
7.4.220.0060.01316.98
7.4.210.0040.01117.06
7.4.200.0000.00816.92
7.4.160.0090.00816.86
7.4.150.0140.00317.40
7.4.140.0070.01217.86
7.4.130.0060.01316.83
7.4.120.0090.01416.77
7.4.110.0110.00716.99
7.4.100.0060.01016.89
7.4.90.0070.01016.75
7.4.80.0110.01219.39
7.4.70.0120.00316.82
7.4.60.0100.00716.60
7.4.50.0080.00416.57
7.4.40.0100.00716.63
7.4.30.0030.01316.88
7.4.10.0070.00715.45
7.4.00.0060.00915.24
7.3.330.0000.00513.75
7.3.320.0000.00613.81
7.3.310.0000.00916.60
7.3.300.0040.00416.70
7.3.290.0100.00616.71
7.3.280.0090.01016.74
7.3.270.0090.00917.40
7.3.260.0110.00616.72
7.3.250.0080.01116.60
7.3.240.0120.00516.66
7.3.230.0060.01116.59
7.3.210.0090.00916.92
7.3.200.0120.00916.63
7.3.190.0120.00616.67
7.3.180.0120.00616.87
7.3.170.0160.00016.46
7.3.160.0100.00616.75
7.3.130.0060.00915.11
7.3.120.0070.01115.06
7.3.110.0090.00915.04
7.3.100.0090.00415.13
7.3.90.0000.01415.21
7.3.80.0070.00714.87
7.3.70.0000.00915.28
7.3.60.0090.00314.98
7.3.50.0030.00715.05
7.3.40.0040.01415.16
7.3.30.0030.00715.02
7.3.20.0090.00916.96
7.3.10.0030.00817.05
7.3.00.0090.00516.88
7.2.330.0070.01116.95
7.2.320.0080.00816.88
7.2.310.0060.01116.94
7.2.300.0090.00916.88
7.2.290.0030.01416.90
7.2.260.0120.00615.45
7.2.250.0070.01015.23
7.2.240.0070.00715.34
7.2.230.0090.00615.28
7.2.220.0040.01115.16
7.2.210.0000.01415.32
7.2.200.0070.00715.28
7.2.190.0090.00615.25
7.2.180.0030.01015.34
7.2.170.0060.01015.24
7.2.160.0070.01315.12
7.2.150.0060.00617.32
7.2.140.0070.00717.10
7.2.130.0070.00717.29
7.2.120.0080.00317.08
7.2.110.0050.01117.12
7.2.100.0030.01417.00
7.2.90.0020.01317.09
7.2.80.0050.01017.11
7.2.70.0060.01017.21
7.2.60.0070.00717.34
7.2.50.0060.00817.21
7.2.40.0070.01017.05
7.2.30.0050.00917.23
7.2.20.0060.00817.15
7.2.10.0060.00816.89
7.2.00.0050.01117.15
7.1.330.0040.01116.17
7.1.320.0130.00016.19
7.1.310.0070.00616.08
7.1.300.0030.00716.11
7.1.290.0000.01415.82
7.1.280.0060.00915.85
7.1.270.0060.00915.72
7.1.260.0000.00815.72
7.1.250.0040.00915.96
7.1.240.0080.00416.08
7.1.230.0060.01215.97
7.1.220.0070.01115.95
7.1.210.0060.00915.96
7.1.200.0090.00616.04
7.1.190.0060.00316.20
7.1.180.0060.00316.09
7.1.170.0070.00415.95
7.1.160.0100.00315.88
7.1.150.0070.00715.93
7.1.140.0090.00316.16
7.1.130.0030.01016.10
7.1.120.0030.00916.08
7.1.110.0080.00816.02
7.1.100.0030.01016.00
7.1.90.0030.00716.13
7.1.80.0090.00015.96
7.1.70.0030.01116.79
7.1.60.0090.00416.75
7.1.50.0090.00615.98
7.1.40.0870.03327.34
7.1.30.1000.00724.45
7.1.20.0790.00924.54
7.1.10.0940.00715.50
7.1.00.0600.01115.50
7.0.330.0110.00015.54
7.0.320.0070.01015.57
7.0.310.0060.00915.61
7.0.300.0070.00715.73
7.0.290.0100.00715.70
7.0.280.0000.01215.24
7.0.270.0030.01515.71
7.0.260.0100.00715.69
7.0.250.0040.01215.45
7.0.240.0070.00715.55
7.0.230.0060.00615.54
7.0.220.0070.00315.79
7.0.210.0110.00415.44
7.0.200.0060.00916.19
7.0.190.0100.00315.80
7.0.180.0000.01615.46
7.0.170.1030.01114.98
7.0.160.0820.00815.17
7.0.150.0920.00615.06
7.0.140.0580.01115.29
7.0.130.0710.00815.10
7.0.120.0860.01315.19
7.0.110.0610.01015.16
7.0.100.0610.00615.06
7.0.90.0720.01415.15
7.0.80.0720.00915.13
7.0.70.0600.00815.17
7.0.60.0570.00614.99
7.0.50.0730.01515.28
7.0.40.0780.01614.22
7.0.30.0900.00514.30
7.0.20.1030.01014.21
7.0.10.0810.00914.33
7.0.00.0740.00814.16
5.6.400.0070.00714.58
5.6.390.0030.01214.66
5.6.380.0140.00014.84
5.6.370.0030.01114.57
5.6.360.0070.01014.70
5.6.350.0140.00014.54
5.6.340.0060.00314.79
5.6.330.0120.00314.58
5.6.320.0100.00714.49
5.6.310.0060.00614.52
5.6.300.0000.01414.59
5.6.290.0040.01114.52
5.6.280.0070.01014.97
5.6.270.0090.00914.62
5.6.260.0090.00314.42
5.6.250.0000.01514.80
5.6.240.0030.01214.54
5.6.230.0070.00414.54
5.6.220.0040.00814.45
5.6.210.0060.00314.37
5.6.200.0000.00914.58
5.6.190.0050.00514.52
5.6.180.0100.00314.58
5.6.170.0000.00914.47
5.6.160.0060.00614.90
5.6.150.0000.00814.63
5.6.140.0030.01014.68
5.6.130.0000.01514.62
5.6.120.0070.00714.65
5.6.110.0080.00814.23
5.6.100.0090.00014.59
5.6.90.0000.01414.61
5.6.80.0030.01414.73
5.6.70.0000.01214.55
5.6.60.0040.01514.66
5.6.50.0000.01514.73
5.6.40.0090.00914.46
5.6.30.0120.00614.41
5.6.20.0090.00914.60
5.6.10.0060.00914.30
5.6.00.0040.00714.49

preferences:
40.58 ms | 400 KiB | 5 Q