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 "{$result}\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.0060.00917.25
8.3.50.0070.00718.55
8.3.40.0080.00819.27
8.3.30.0090.00918.91
8.3.20.0120.00620.31
8.3.10.0030.00521.73
8.3.00.0050.00323.53
8.2.180.0100.01018.79
8.2.170.0030.01222.96
8.2.160.0110.00419.54
8.2.150.0000.00725.66
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0050.00321.25
8.2.110.0060.00322.39
8.2.100.0060.00618.41
8.2.90.0090.00019.47
8.2.80.0050.00317.97
8.2.70.0050.00517.71
8.2.60.0040.00418.05
8.2.50.0040.00418.10
8.2.40.0080.00022.21
8.2.30.0050.00319.38
8.2.20.0040.00418.32
8.2.10.0000.01018.32
8.2.00.0000.00718.36
8.1.280.0110.00725.92
8.1.270.0090.00020.84
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0090.00022.73
8.1.230.0140.00017.70
8.1.220.0040.00417.90
8.1.210.0030.00618.77
8.1.200.0090.00017.85
8.1.190.0050.00517.73
8.1.180.0050.00318.10
8.1.170.0000.00722.31
8.1.160.0000.00819.03
8.1.150.0070.00020.47
8.1.140.0040.00419.82
8.1.130.0070.00019.28
8.1.120.0040.00417.76
8.1.110.0000.00817.71
8.1.100.0080.00017.74
8.1.90.0070.00017.77
8.1.80.0000.00717.74
8.1.70.0000.00717.57
8.1.60.0040.00417.90
8.1.50.0000.00817.80
8.1.40.0040.00417.81
8.1.30.0040.00417.93
8.1.20.0000.00817.86
8.1.10.0040.00417.82
8.1.00.0040.00417.77
8.0.300.0000.00818.77
8.0.290.0050.00217.13
8.0.280.0030.00318.44
8.0.270.0030.00317.45
8.0.260.0030.00317.39
8.0.250.0070.00017.38
8.0.240.0000.00717.24
8.0.230.0070.00017.29
8.0.220.0000.00817.34
8.0.210.0030.00317.23
8.0.200.0030.00317.36
8.0.190.0050.00317.24
8.0.180.0030.00517.35
8.0.170.0040.00417.32
8.0.160.0070.00017.23
8.0.150.0000.00717.03
8.0.140.0090.00017.09
8.0.130.0060.00013.69
8.0.120.0040.00417.11
8.0.110.0050.00217.20
8.0.100.0040.00417.15
8.0.90.0040.00417.27
8.0.80.0030.01317.27
8.0.70.0040.00417.18
8.0.60.0060.00317.11
8.0.50.0030.00517.06
8.0.30.0080.00917.37
8.0.20.0080.01417.48
8.0.10.0000.00717.17
8.0.00.0070.01116.96
7.4.330.0020.00215.55
7.4.320.0040.00416.92
7.4.300.0060.00016.88
7.4.290.0000.00716.90
7.4.280.0040.00416.91
7.4.270.0000.00716.90
7.4.260.0030.00816.84
7.4.250.0000.00717.02
7.4.240.0070.00016.91
7.4.230.0040.00416.88
7.4.220.0030.01616.93
7.4.210.0030.01117.00
7.4.200.0000.00717.11
7.4.160.0090.01016.89
7.4.150.0130.01317.40
7.4.140.0090.01217.86
7.4.130.0120.00916.83
7.4.120.0070.01316.93
7.4.110.0030.01516.82
7.4.100.0090.00916.81
7.4.90.0160.00316.75
7.4.80.0080.00919.39
7.4.70.0060.01016.93
7.4.60.0000.01717.18
7.4.50.0070.01016.67
7.4.40.0040.01416.71
7.4.30.0160.00316.96
7.4.10.0120.00615.24
7.4.00.0100.01015.15
7.3.330.0000.00613.73
7.3.320.0000.00513.56
7.3.310.0020.00516.61
7.3.300.0030.00316.80
7.3.290.0070.00816.74
7.3.280.0110.00716.71
7.3.270.0030.01417.40
7.3.260.0070.01216.76
7.3.250.0070.01416.86
7.3.240.0110.00816.80
7.3.230.0090.01616.65
7.3.210.0080.00916.63
7.3.200.0100.01116.84
7.3.190.0100.00616.60
7.3.180.0060.01216.95
7.3.170.0120.00616.61
7.3.160.0000.01516.89
7.3.130.0000.01415.26
7.3.120.0060.00815.28
7.3.110.0070.01214.99
7.3.100.0070.00815.02
7.3.90.0020.01014.98
7.3.80.0080.00515.15
7.3.70.0030.01115.15
7.3.60.0050.00415.13
7.3.50.0050.00914.98
7.3.40.0080.00615.08
7.3.30.0130.00215.02
7.3.20.0080.00517.10
7.3.10.0070.00416.91
7.3.00.0050.01017.04
7.2.330.0130.00417.02
7.2.320.0190.00417.02
7.2.310.0060.01016.79
7.2.300.0090.01016.92
7.2.290.0030.01317.01
7.2.260.0090.00915.36
7.2.250.0030.01315.27
7.2.240.0050.01215.47
7.2.230.0060.00815.36
7.2.220.0060.00615.29
7.2.210.0020.01015.41
7.2.200.0070.00815.35
7.2.190.0050.01115.54
7.2.180.0050.00815.32
7.2.170.0080.00515.39
7.2.160.0050.01015.41
7.2.150.0050.00816.91
7.2.140.0060.00717.24
7.2.130.0070.00817.01
7.2.120.0050.00917.03
7.2.110.0060.01016.91
7.2.100.0050.00916.99
7.2.90.0080.00617.25
7.2.80.0070.00717.24
7.2.70.0080.00517.02
7.2.60.0050.00617.11
7.2.50.0070.00917.00
7.2.40.0080.00917.38
7.2.30.0080.00817.26
7.2.20.0080.00516.95
7.2.10.0060.00617.21
7.2.00.0080.00317.14
7.1.330.0070.00716.22
7.1.320.0100.00316.10
7.1.310.0040.00916.10
7.1.300.0070.00515.81
7.1.290.0060.00715.77
7.1.280.0060.01016.03
7.1.270.0050.00915.89
7.1.260.0070.00816.11
7.1.250.0030.00916.01
7.1.240.0040.00716.01
7.1.230.0030.01316.15
7.1.220.0080.00416.10
7.1.210.0000.01115.83
7.1.200.0070.00915.83
7.1.190.0070.01016.03
7.1.180.0080.00616.21
7.1.170.0100.00315.79
7.1.160.0000.01315.98
7.1.150.0000.01016.15
7.1.140.0030.00716.25
7.1.130.0070.01015.93
7.1.120.0090.00615.91
7.1.110.0000.00815.81
7.1.100.0170.00016.19
7.1.90.0070.01116.22
7.1.80.0080.00016.18
7.1.70.0040.00716.72
7.1.60.0030.00616.96
7.1.50.0050.00816.69
7.1.40.1420.04027.30
7.1.30.0840.01324.61
7.1.20.1070.01024.52
7.1.10.0980.00515.46
7.1.00.1320.00815.63
7.0.330.0030.00515.67
7.0.320.0030.00715.39
7.0.310.0110.00415.75
7.0.300.0120.00315.60
7.0.290.0030.00715.56
7.0.280.0070.00715.69
7.0.270.0000.01115.39
7.0.260.0000.00915.74
7.0.250.0030.00915.80
7.0.240.0110.00415.86
7.0.230.0040.01115.49
7.0.220.0090.00315.75
7.0.210.0040.00915.47
7.0.200.0100.00816.23
7.0.190.0080.00415.63
7.0.180.0030.01015.71
7.0.170.1480.01315.12
7.0.160.0780.01215.22
7.0.150.0920.01115.12
7.0.140.1370.00915.20
7.0.130.1180.01115.36
7.0.120.1100.00715.28
7.0.110.1120.00815.08
7.0.100.1330.01015.06
7.0.90.0680.00715.31
7.0.80.1350.01015.18
7.0.70.1110.00815.24
7.0.60.1130.01415.13
7.0.50.0930.00515.31
7.0.40.1100.00914.30
7.0.30.0700.01314.39
7.0.20.1350.01014.30
7.0.10.0850.00914.28
7.0.00.1040.00514.21
5.6.400.0000.01714.54
5.6.390.0090.00314.73
5.6.380.0030.01014.71
5.6.370.0030.01314.83
5.6.360.0030.00614.86
5.6.350.0090.00414.51
5.6.340.0000.01614.54
5.6.330.0100.00314.85
5.6.320.0080.00814.54
5.6.310.0060.00914.50
5.6.300.0060.00614.66
5.6.290.0100.00614.50
5.6.280.0040.00814.68
5.6.270.0040.01114.75
5.6.260.0040.01414.57
5.6.250.0100.00714.67
5.6.240.0000.01714.62
5.6.230.0000.00914.54
5.6.220.0040.00814.35
5.6.210.0030.01314.64
5.6.200.0040.01214.80
5.6.190.0080.00414.46
5.6.180.0120.00315.00
5.6.170.0060.00914.67
5.6.160.0000.00814.40
5.6.150.0030.00914.55
5.6.140.0030.01314.54
5.6.130.0030.01014.89
5.6.120.0100.00314.88
5.6.110.0070.01014.41
5.6.100.0090.00314.62
5.6.90.0000.01314.48
5.6.80.0110.00414.44
5.6.70.0000.01114.30
5.6.60.0000.00814.66
5.6.50.0030.00614.62
5.6.40.0060.00814.76
5.6.30.0070.01014.46
5.6.20.0130.00314.44
5.6.10.0000.01514.79
5.6.00.0080.00814.67

preferences:
54.77 ms | 401 KiB | 5 Q