3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class NonUtfToUtfOffset { /** @var int[] */ private $utfMap = []; public function __construct(string $content) { $contentLength = mb_strlen($content); for ($offset = 0; $offset < $contentLength; $offset ++) { $char = mb_substr($content, $offset, 1); $nonUtfLength = strlen($char); for ($charOffset = 0; $charOffset < $nonUtfLength; $charOffset ++) { $this->utfMap[] = $offset; } } } public function convertOffset(int $nonUtfOffset): int { return $this->utfMap[$nonUtfOffset]; } } $content = 'aą bać d'; $offsetConverter = new NonUtfToUtfOffset($content); preg_match_all('#(bać)#ui', $content, $m, PREG_OFFSET_CAPTURE); foreach ($m[1] as [$word, $offset]) { echo "bad: " . mb_substr($content, $offset, mb_strlen($word))."\n"; echo "good: " . mb_substr($content, $offsetConverter->convertOffset($offset), mb_strlen($word))."\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.4.10.0000.00919.67
8.3.140.0040.00418.79
8.3.130.0040.00718.61
8.3.120.0090.00918.78
8.3.110.0150.00620.94
8.3.100.0030.00624.06
8.3.90.0030.00726.77
8.3.80.0060.00316.88
8.3.70.0120.00917.00
8.3.60.0150.00617.00
8.3.50.0110.00916.93
8.3.40.0070.00719.08
8.3.30.0090.00618.95
8.3.20.0040.00421.73
8.3.10.0030.00623.52
8.3.00.0000.00818.12
8.2.250.0100.00016.85
8.2.240.0110.00719.06
8.2.230.0000.00922.58
8.2.220.0030.00637.54
8.2.210.0040.00426.77
8.2.200.0060.00616.47
8.2.190.0030.01016.75
8.2.180.0200.00325.92
8.2.170.0100.00719.04
8.2.160.0090.00621.32
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0000.00826.16
8.2.120.0000.00820.08
8.2.110.0030.00620.56
8.2.100.0080.00418.16
8.2.90.0000.00919.35
8.2.80.0030.00517.97
8.2.70.0060.00318.03
8.2.60.0000.00818.34
8.2.50.0000.00817.75
8.2.40.0040.00419.72
8.2.30.0040.00421.18
8.2.20.0050.00218.27
8.2.10.0060.00318.21
8.2.00.0000.00818.26
8.1.300.0030.00516.39
8.1.290.0060.00318.88
8.1.280.0100.01025.92
8.1.270.0000.00724.66
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0040.00723.89
8.1.230.0060.00622.07
8.1.220.0050.00517.91
8.1.210.0030.00518.77
8.1.200.0060.00317.63
8.1.190.0060.00317.38
8.1.180.0000.00918.10
8.1.170.0040.00417.64
8.1.160.0050.00218.89
8.1.150.0040.00420.20
8.1.140.0040.00419.63
8.1.130.0000.00717.58
8.1.120.0000.00717.61
8.1.110.0040.00417.65
8.1.100.0050.00517.64
8.1.90.0040.00417.61
8.1.80.0000.00717.54
8.1.70.0070.00017.66
8.1.60.0030.00617.83
8.1.50.0070.00017.77
8.1.40.0060.00317.63
8.1.30.0050.00317.82
8.1.20.0000.00817.76
8.1.10.0040.00417.65
8.1.00.0030.00517.61
8.0.300.0000.00720.09
8.0.290.0040.00417.00
8.0.280.0030.00318.53
8.0.270.0030.00318.28
8.0.260.0070.00017.01
8.0.250.0030.00317.26
8.0.240.0000.00917.23
8.0.230.0000.00717.12
8.0.220.0000.01117.17
8.0.210.0040.00417.27
8.0.200.0030.00317.23
8.0.190.0060.00317.06
8.0.180.0080.00017.07
8.0.170.0000.00817.26
8.0.160.0040.00417.19
8.0.150.0060.00317.02
8.0.140.0080.00017.13
8.0.130.0060.00013.59
8.0.120.0030.00517.20
8.0.110.0040.00417.29
8.0.100.0050.00217.20
8.0.90.0040.00417.23
8.0.80.0120.00417.20
8.0.70.0040.00417.09
8.0.60.0000.00817.27
8.0.50.0000.00817.13
8.0.30.0110.00717.37
8.0.20.0120.00817.52
8.0.10.0020.00517.26
8.0.00.0140.01417.17
7.4.330.0050.00015.55
7.4.320.0060.00016.89
7.4.300.0030.00316.93
7.4.290.0060.00316.72
7.4.280.0000.00816.86
7.4.270.0000.00816.90
7.4.260.0070.00016.73
7.4.250.0070.00016.84
7.4.240.0040.00416.89
7.4.230.0030.00316.90
7.4.220.0000.00816.97
7.4.210.0070.00816.82
7.4.200.0070.00016.88
7.4.160.0060.01216.65
7.4.150.0060.01217.40
7.4.140.0120.00717.86
7.4.130.0070.01116.84
7.4.120.0090.00916.78
7.4.110.0090.00916.77
7.4.100.0070.01016.75
7.4.90.0140.00316.64
7.4.80.0070.01019.39
7.4.70.0120.00416.77
7.4.60.0070.01016.92
7.4.50.0090.00616.71
7.4.40.0080.00916.79
7.4.30.0030.01316.65
7.4.10.0070.01115.17
7.4.00.0100.00514.93
7.3.330.0000.00513.39
7.3.320.0030.00313.30
7.3.310.0050.00216.48
7.3.300.0030.00316.44
7.3.290.0060.00916.61
7.3.280.0090.00716.57
7.3.270.0100.01317.40
7.3.260.0120.00716.72
7.3.250.0100.00916.68
7.3.240.0080.00816.71
7.3.230.0110.00716.70
7.3.210.0110.00616.64
7.3.200.0150.00816.82
7.3.190.0100.00616.69
7.3.180.0100.01016.62
7.3.170.0150.00316.83
7.3.160.0100.00716.61
7.3.130.0100.00315.09
7.3.120.0070.00715.08
7.3.110.0090.00915.17
7.3.100.0110.00314.89
7.3.90.0050.01114.82
7.3.80.0090.00615.12
7.3.70.0100.00615.10
7.3.60.0060.00914.94
7.3.50.0060.00915.11
7.3.40.0070.00915.14
7.3.30.0110.00315.05
7.3.20.0080.01215.86
7.3.10.0060.00716.18
7.3.00.0050.00816.01
7.2.330.0150.00916.88
7.2.320.0070.01116.79
7.2.310.0130.00316.92
7.2.300.0120.00916.82
7.2.290.0040.01317.00
7.2.260.0000.01915.45
7.2.250.0040.01115.30
7.2.240.0030.01415.40
7.2.230.0090.00615.26
7.2.220.0060.01215.17
7.2.210.0030.01315.16
7.2.200.0090.00915.45
7.2.190.0080.00815.31
7.2.180.0050.00915.50
7.2.170.0050.01115.40
7.2.160.0090.00615.48
7.2.150.0030.01116.30
7.2.140.0050.00716.28
7.2.130.0070.00916.29
7.2.120.0080.00816.08
7.2.110.0050.01116.21
7.2.100.0060.00716.23
7.2.90.0100.00316.18
7.2.80.0040.01016.20
7.2.70.0070.01116.00
7.2.60.0080.00916.46
7.2.50.0050.00916.31
7.2.40.2030.01016.95
7.2.30.1100.01116.85
7.2.20.1160.01116.94
7.2.10.1000.01016.94
7.2.00.0820.00816.91
7.1.330.0030.01415.75
7.1.320.0100.00715.01
7.1.310.0080.00915.05
7.1.300.0450.01015.15
7.1.290.0040.01015.00
7.1.280.0060.01115.02
7.1.270.0110.00515.03
7.1.260.0070.00715.08
7.1.250.0060.00715.05
7.1.240.0080.00715.02
7.1.230.0090.00715.07
7.1.220.0100.00714.96
7.1.210.0090.00914.98
7.1.200.0070.00915.44
7.1.190.0080.00815.17
7.1.180.0130.00715.01
7.1.170.0110.00615.24
7.1.160.1440.01015.87
7.1.150.1120.00615.74
7.1.140.1150.00915.90
7.1.130.0910.01315.73
7.1.120.0880.01115.79
7.1.110.0980.00815.58
7.1.100.0810.01015.58
7.1.90.0990.01215.44
7.1.80.1150.01015.78
7.1.70.0780.00915.65
7.1.60.1000.00926.08
7.1.50.0610.01825.91
7.1.40.0850.01225.63
7.1.30.0630.01325.68
7.1.20.0840.00925.81
7.1.10.0830.01015.10
7.1.00.0720.01115.13
7.0.330.0090.00913.05
7.0.320.0110.01113.45
7.0.310.0140.00613.38
7.0.300.0490.00313.36
7.0.290.1750.00614.56
7.0.280.0170.00213.44
7.0.270.1390.00614.94
7.0.260.1090.01014.83
7.0.250.1200.00614.43
7.0.240.1020.01114.77
7.0.230.1300.00614.42
7.0.220.1190.01114.58
7.0.210.0850.00813.85
7.0.200.1050.00914.35
7.0.190.0760.01414.38
7.0.180.1390.00914.08
7.0.170.0680.01514.08
7.0.160.0800.01114.09
7.0.150.1370.01013.96
7.0.140.0460.00913.99
7.0.130.0960.01014.20
7.0.120.0850.01214.17
7.0.110.0790.00914.03
7.0.100.1410.01214.05
7.0.90.0760.01314.05
7.0.80.1670.01014.12
7.0.70.0840.01214.15
7.0.60.0850.00713.91
7.0.50.0860.01114.17
7.0.40.1020.01114.30
7.0.30.0860.00714.23
7.0.20.0930.00914.18
7.0.10.0800.01114.21
7.0.00.0790.01114.16
5.6.400.0160.00414.03
5.6.390.0160.00413.91
5.6.380.0090.01414.27
5.6.370.0120.01214.13
5.6.360.0090.01114.40
5.6.350.0130.01014.30
5.6.340.0090.01314.26
5.6.330.0150.00514.20
5.6.320.0080.01114.05
5.6.310.0070.01213.77
5.6.300.0150.05419.09
5.6.290.0180.05119.15
5.6.280.0150.05219.25
5.6.270.0170.05619.11
5.6.260.0170.04619.13
5.6.250.0180.05419.20
5.6.240.0150.05219.19
5.6.230.0200.04719.16
5.6.220.0150.05319.20
5.6.210.0140.05319.13
5.6.200.0130.05719.16
5.6.190.0160.05719.07
5.6.180.0160.05319.10
5.6.170.0170.05419.14
5.6.160.0210.05319.21
5.6.150.0140.05919.19
5.6.140.0150.06319.17
5.6.130.0130.05719.13
5.6.120.0160.05919.13
5.6.110.0180.05419.13
5.6.100.0170.05419.08
5.6.90.0150.05419.09
5.6.80.0180.04918.69
5.6.70.0160.05618.73
5.6.60.0160.06218.67
5.6.50.0210.04918.68
5.6.40.0170.05618.63
5.6.30.0160.05318.64
5.6.20.0180.05218.58
5.6.10.0150.04918.57
5.6.00.0130.05118.56
5.5.380.0110.00714.19
5.5.370.0110.00813.73
5.5.360.0090.01313.80
5.5.350.0100.01014.11
5.5.340.0000.02113.70
5.5.330.0170.00414.25
5.5.320.0090.01013.86
5.5.310.0210.00014.21
5.5.300.0130.00713.74
5.5.290.0150.01014.05
5.5.280.0100.01014.02
5.5.270.0090.01413.95
5.5.260.0150.00913.62
5.5.250.0150.00813.70
5.5.240.0210.00013.76
5.5.230.0100.01014.00
5.5.220.0130.00913.64
5.5.210.0140.01013.84
5.5.200.0140.01413.95
5.5.190.0190.00914.10
5.5.180.0140.01114.07
5.5.170.0160.00813.89
5.5.160.0140.00713.75
5.5.150.0080.02014.00
5.5.140.0160.00513.82
5.5.130.0210.00014.00
5.5.120.0150.00613.91
5.5.110.0100.01013.95
5.5.100.0090.01014.18
5.5.90.0130.00713.99
5.5.80.0120.00514.04
5.5.70.0160.00414.21
5.5.60.0140.01013.81
5.5.50.0130.00914.10
5.5.40.0100.01214.14
5.5.30.0100.00814.06
5.5.20.0150.00614.29
5.5.10.0160.01013.76
5.5.00.0040.01513.82
5.4.450.0120.00610.69
5.4.440.0090.00610.86
5.4.430.0090.00610.75
5.4.420.0120.00410.75
5.4.410.0100.00610.83
5.4.400.0130.00310.41
5.4.390.0090.00610.38
5.4.380.0150.00610.68
5.4.370.0140.00510.92
5.4.360.0050.01110.83
5.4.350.0120.00910.69
5.4.340.0150.00310.76
5.4.330.0070.01110.80
5.4.320.0080.00910.61
5.4.310.0150.00610.97
5.4.300.0160.00410.89
5.4.290.0070.00710.77
5.4.280.0050.01010.79
5.4.270.0070.00710.76
5.4.260.0170.00010.86
5.4.250.0050.01010.77
5.4.240.0150.00010.75
5.4.230.0140.00711.00
5.4.220.0000.01810.74
5.4.210.0140.00410.41
5.4.200.0090.00510.65
5.4.190.0090.00610.77
5.4.180.0150.00310.45
5.4.170.0160.00510.96
5.4.160.0060.00910.41
5.4.150.0110.00310.92
5.4.140.0150.00010.52
5.4.130.0070.00710.74
5.4.120.0080.00510.79
5.4.110.0130.00310.88
5.4.100.0100.00511.12
5.4.90.0090.00610.75
5.4.80.0070.00710.89
5.4.70.0100.00510.84
5.4.60.0090.00510.95
5.4.50.0070.00610.61
5.4.40.0100.00710.88
5.4.30.0080.00810.54
5.4.20.0070.01410.68
5.4.10.0100.00710.75
5.4.00.0120.00310.48
5.3.290.0040.01310.17
5.3.280.0030.01110.18
5.3.270.0150.00010.17
5.3.260.0140.00410.17
5.3.250.0090.00510.17
5.3.240.0100.00310.17
5.3.230.0070.00710.17
5.3.220.0040.00810.17
5.3.210.0100.00310.17
5.3.200.0130.00010.18
5.3.190.0130.00010.31
5.3.180.0090.00410.39
5.3.170.0100.00310.30
5.3.160.0100.00310.36
5.3.150.0080.00410.39
5.3.140.0110.00410.27
5.3.130.0100.00510.30
5.3.120.0030.01010.29
5.3.110.0000.01810.17
5.3.100.0110.00410.30
5.3.90.0140.00310.25
5.3.80.0110.00910.29
5.3.70.0070.00710.17
5.3.60.0080.00810.33
5.3.50.0140.00010.23
5.3.40.0090.00610.17
5.3.30.0110.00310.24
5.3.20.0100.00310.17
5.3.10.0040.00910.17
5.3.00.0100.00310.17
5.2.170.0030.00710.17
5.2.160.0040.00710.17
5.2.150.0040.00810.17
5.2.140.0120.00010.17
5.2.130.0080.00410.17
5.2.120.0070.00710.17
5.2.110.0050.00910.17
5.2.100.0090.00410.17
5.2.90.0060.00610.17
5.2.80.0020.00710.17
5.2.70.0090.00310.17
5.2.60.0060.00310.17
5.2.50.0040.00710.17
5.2.40.0060.00410.17
5.2.30.0120.00010.17
5.2.20.0110.00010.17
5.2.10.0060.00610.17
5.2.00.0110.00010.17
5.1.60.0060.00610.17
5.1.50.0090.00010.17
5.1.40.0080.00310.17
5.1.30.0080.00410.17
5.1.20.0100.00010.17
5.1.10.0090.00010.17
5.1.00.0040.00710.17
5.0.50.0080.00010.17
5.0.40.0030.00610.17
5.0.30.0040.00710.17
5.0.20.0060.00310.17
5.0.10.0080.00010.17
5.0.00.0020.00510.17
4.4.90.0030.00310.17
4.4.80.0000.00610.17
4.4.70.0070.00210.17
4.4.60.0060.00310.17
4.4.50.0040.00210.17
4.4.40.0040.00410.17
4.4.30.0050.00510.17
4.4.20.0050.00210.17
4.4.10.0040.00410.17
4.4.00.0040.00410.17
4.3.110.0000.00910.17
4.3.100.0070.00010.17
4.3.90.0000.00710.17
4.3.80.0040.00210.17
4.3.70.0030.00310.17
4.3.60.0070.00010.17
4.3.50.0060.00010.17
4.3.40.0020.00510.17
4.3.30.0000.00810.17
4.3.20.0030.00310.17
4.3.10.0000.00610.17
4.3.00.0030.00310.17

preferences:
68.22 ms | 403 KiB | 5 Q