3v4l.org

run code in 300+ PHP versions simultaneously
<?php mb_internal_encoding('UTF-8'); $full_string = 'ĂȘtre vivant'; $match = 'vivant'; //) is ĂȘtr<strong>e viva</strong>nt echo Foo::highlightTerm($full_string, $match); class Foo{ public static function highlightTerm($full_string, $match){ $full_string_ascii = preg_replace_callback('/[\w]+/ui', array('self', 'callbackHighlightTerm'), $full_string); $match_ascii = preg_replace_callback('/[\w]+/ui', array('self', 'callbackHighlightTerm'), $match); $start = stripos($full_string_ascii, $match_ascii); if($start===FALSE){ return $full_string; }else{ $length = mb_strlen($match); return htmlspecialchars( mb_substr($full_string, 0, $start)) . '<strong>' . htmlspecialchars( mb_substr($full_string, $start, $length) ) . '</strong>' . htmlspecialchars( mb_substr($full_string, $start+$length) ); } } private static function callbackHighlightTerm($matches){ return preg_replace('/[^\w]/i', '', iconv('UTF-8', 'ASCII//TRANSLIT', $matches[0])); } } ?>

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.40.0110.00419.23
8.3.30.0150.00019.04
8.3.20.0080.00018.82
8.3.10.0030.00521.22
8.3.00.0040.00423.62
8.2.170.0000.01522.96
8.2.160.0070.00720.48
8.2.150.0050.00324.18
8.2.140.0030.00624.66
8.2.130.0060.00326.16
8.2.120.0090.00019.85
8.2.110.0030.00620.34
8.2.100.0090.00318.28
8.2.90.0050.00319.40
8.2.80.0040.00417.97
8.2.70.0060.00317.88
8.2.60.0000.00918.04
8.2.50.0040.00418.07
8.2.40.0050.00318.34
8.2.30.0000.00819.34
8.2.20.0040.00418.05
8.2.10.0050.00317.84
8.2.00.0090.00317.83
8.1.270.0050.00323.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.00922.59
8.1.230.0040.00720.90
8.1.220.0040.00418.77
8.1.210.0040.00418.86
8.1.200.0060.00317.60
8.1.190.0050.00317.66
8.1.180.0060.00318.10
8.1.170.0040.00418.71
8.1.160.0040.00418.97
8.1.150.0050.00318.85
8.1.140.0000.00817.66
8.1.130.0080.00017.85
8.1.120.0040.00717.59
8.1.110.0080.00017.48
8.1.100.0000.00817.51
8.1.90.0040.00417.59
8.1.80.0070.00017.52
8.1.70.0000.00717.50
8.1.60.0040.00417.79
8.1.50.0000.00817.70
8.1.40.0060.00317.79
8.1.30.0040.00417.82
8.1.20.0080.00017.81
8.1.10.0000.00817.77
8.1.00.0030.00517.71
8.0.300.0030.00619.97
8.0.290.0000.00717.30
8.0.280.0030.00318.53
8.0.270.0070.00017.34
8.0.260.0000.00717.09
8.0.250.0070.00017.28
8.0.240.0000.00817.26
8.0.230.0030.00317.21
8.0.220.0050.00217.20
8.0.210.0000.00717.23
8.0.200.0000.00717.25
8.0.190.0040.00417.12
8.0.180.0070.00017.23
8.0.170.0040.00417.08
8.0.160.0000.00717.13
8.0.150.0040.00417.09
8.0.140.0000.00717.16
8.0.130.0050.00013.57
8.0.120.0060.00317.22
8.0.110.0040.00417.27
8.0.100.0000.00917.25
8.0.90.0030.00617.38
8.0.80.0130.00317.28
8.0.70.0000.00917.18
8.0.60.0060.00317.36
8.0.50.0060.00317.28
8.0.30.0130.01017.53
8.0.20.0150.01217.46
8.0.10.0060.00317.07
8.0.00.0130.00917.19
7.4.330.0000.00515.00
7.4.320.0050.00316.88
7.4.300.0000.00716.78
7.4.290.0000.00716.88
7.4.280.0080.00016.67
7.4.270.0080.00016.79
7.4.260.0030.00313.59
7.4.250.0030.00616.89
7.4.240.0030.00616.96
7.4.230.0030.00617.12
7.4.220.0120.01216.87
7.4.210.0070.00916.99
7.4.200.0040.00417.11
7.4.190.0060.00317.01
7.4.160.0080.01217.06
7.4.150.0140.00617.40
7.4.140.0100.01017.86
7.4.130.0110.00816.91
7.4.120.0090.01016.90
7.4.110.0070.01616.95
7.4.100.0040.01716.69
7.4.90.0100.01716.77
7.4.80.0090.01219.39
7.4.70.0090.01216.77
7.4.60.0110.01516.85
7.4.50.0030.01316.89
7.4.40.0100.01119.55
7.4.30.0120.00916.91
7.4.20.0070.01516.70
7.4.10.0120.01216.77
7.4.00.0040.01216.11
7.3.330.0000.00613.43
7.3.320.0050.00013.57
7.3.310.0050.00316.61
7.3.300.0040.00416.72
7.3.290.0070.01016.72
7.3.280.0070.01416.71
7.3.270.0090.01217.40
7.3.260.0080.01118.24
7.3.250.0080.01116.69
7.3.240.0110.00816.76
7.3.230.0130.00716.80
7.3.210.0120.00916.63
7.3.200.0100.01016.87
7.3.190.0090.01316.72
7.3.180.0150.00816.84
7.3.170.0100.01316.83
7.3.160.0090.00916.79
7.3.150.0150.00616.95
7.3.140.0130.00716.87
7.3.130.0070.01416.52
7.3.120.0060.01215.90
7.3.110.0140.00616.66
7.3.100.0030.01716.89
7.3.90.0100.01016.71
7.3.80.0040.02016.67
7.3.70.0040.01616.77
7.3.60.0120.00916.71
7.3.50.0060.01216.84
7.3.40.0160.00216.79
7.3.30.0120.00816.77
7.3.20.0130.00516.88
7.3.10.0060.01516.71
7.3.00.0040.01616.73
7.2.330.0100.01016.96
7.2.320.0100.01717.04
7.2.310.0050.01916.93
7.2.300.0110.00917.05
7.2.290.0100.01016.99
7.2.280.0120.01216.91
7.2.270.0120.00917.14
7.2.260.0070.01517.02
7.2.250.0100.01016.66
7.2.240.0080.01416.96
7.2.230.0080.01216.97
7.2.220.0060.01516.98
7.2.210.0100.01417.09
7.2.200.0160.00616.80
7.2.190.0110.00717.08
7.2.180.0100.01017.12
7.2.170.0070.01416.77
7.2.160.0170.00316.80
7.2.150.0280.01116.88
7.2.140.0240.01917.18
7.2.130.0140.00717.05
7.2.120.0130.00617.00
7.2.110.0170.01316.89
7.2.100.0140.01116.93
7.2.90.0110.01116.86
7.2.80.0080.01117.12
7.2.70.0050.01517.06
7.2.60.0060.01317.19
7.2.50.0080.01117.05
7.2.40.0090.01217.03
7.2.30.0090.01217.09
7.2.20.0130.00717.14
7.2.10.0030.01717.13
7.2.00.0080.01018.40
7.1.330.0120.01216.06
7.1.320.0760.01515.86
7.1.310.0180.00715.71
7.1.300.0090.01515.73
7.1.290.0140.01215.63
7.1.280.0180.01015.76
7.1.270.0140.00915.60
7.1.260.0310.00816.05
7.1.250.0180.00915.96
7.1.240.0110.01515.63
7.1.230.0190.00715.76
7.1.220.0190.00615.85
7.1.210.0120.00915.75
7.1.200.0090.00915.85
7.1.190.0050.02115.73
7.1.180.0130.01015.73
7.1.170.0430.01015.68
7.1.160.0120.01215.78
7.1.150.0110.01415.59
7.1.140.0140.01315.46
7.1.130.0290.00415.91
7.1.120.0170.01316.05
7.1.110.0260.00415.88
7.1.100.0140.00717.20
7.1.90.0210.00915.97
7.1.80.0250.00615.86
7.1.70.0140.00516.76
7.1.60.0180.01217.62
7.1.50.0140.01516.60
7.1.40.0210.00915.72
7.1.30.0740.01016.08
7.1.20.0210.00915.81
7.1.10.0180.01315.96
7.1.00.0160.04019.41
7.0.330.0170.00715.35
7.0.320.0160.01315.44
7.0.310.0090.00915.59
7.0.300.0150.00915.07
7.0.290.0110.01115.57
7.0.280.0260.01015.39
7.0.270.0220.00715.78
7.0.260.0230.00715.69
7.0.250.0200.01115.65
7.0.240.0160.01215.72
7.0.230.0510.01115.55
7.0.220.0160.01615.47
7.0.210.0190.00815.63
7.0.200.0120.00716.08
7.0.190.0150.01115.43
7.0.180.0160.01315.41
7.0.170.0190.01015.36
7.0.160.0210.00915.77
7.0.150.0180.01315.47
7.0.140.0180.03918.93
7.0.130.0210.01115.85
7.0.120.0160.01315.63
7.0.110.0160.04817.74
7.0.100.0120.04017.93
7.0.90.0160.03817.84
7.0.80.0200.03617.86
7.0.70.0180.04017.83
7.0.60.0180.03517.93
7.0.50.0190.04118.04
7.0.40.0080.05018.00
7.0.30.0150.04618.07
7.0.20.0150.02517.97
7.0.10.0150.03917.89
7.0.00.0190.04217.94
5.6.400.0150.01516.28
5.6.390.0180.01416.39
5.6.380.0190.00816.00
5.6.370.0080.01616.12
5.6.360.0240.00016.14
5.6.350.0110.01415.98
5.6.340.0140.01115.89
5.6.330.0210.01516.33
5.6.320.0180.01316.21
5.6.310.0230.00915.99
5.6.300.0120.02216.12
5.6.290.0240.00816.26
5.6.280.0110.04518.47
5.6.270.0120.02116.34
5.6.260.0150.03818.43
5.6.250.0100.03218.41
5.6.240.0130.03618.56
5.6.230.0210.04118.50
5.6.220.0140.04218.42
5.6.210.0090.03618.56
5.6.200.0130.04818.78
5.6.190.0200.04118.70
5.6.180.0140.04818.62
5.6.170.0190.04418.71
5.6.160.0100.05218.69
5.6.150.0170.04618.85
5.6.140.0130.04818.70
5.6.130.0170.04418.74
5.6.120.0180.03618.75
5.6.110.0120.03418.73
5.6.100.0110.03618.87
5.6.90.0170.04718.80
5.6.80.0130.04518.32
5.6.70.0120.04518.34
5.6.60.0120.02718.45
5.6.50.0190.04218.40
5.6.40.0130.03818.40
5.6.30.0090.04718.31
5.6.20.0040.05018.43
5.6.10.0170.04318.34
5.6.00.0160.04318.30
5.5.380.0160.04418.45
5.5.370.0140.04718.32
5.5.360.0170.04218.19
5.5.350.0180.04018.35
5.5.340.0130.04718.62
5.5.330.0150.05018.64
5.5.320.0190.04318.60
5.5.310.0130.04518.58
5.5.300.0160.04618.63
5.5.290.0110.05018.48
5.5.280.0140.05018.59
5.5.270.0160.04118.53
5.5.260.0130.04718.67
5.5.250.0180.04418.46
5.5.240.0160.04518.37
5.5.230.0160.04018.26
5.5.220.0150.04218.28
5.5.210.0200.03918.12
5.5.200.0070.04518.29
5.5.190.0110.04618.21
5.5.180.0190.04018.31
5.5.170.0220.00716.09
5.5.160.0180.04418.25
5.5.150.0160.04418.20
5.5.140.0150.04518.25
5.5.130.0170.04618.35
5.5.120.0200.03418.16
5.5.110.0110.03118.23
5.5.100.0080.04518.24
5.5.90.0070.04618.04
5.5.80.0180.03118.30
5.5.70.0180.02618.09
5.5.60.0140.04518.15
5.5.50.0120.04518.27
5.5.40.0180.03918.26
5.5.30.0170.03718.27
5.5.20.0130.05018.04
5.5.10.0170.03718.19
5.5.00.0230.04018.18
5.4.450.0130.02616.25
5.4.440.0100.04416.30
5.4.430.0100.05016.22
5.4.420.0090.04316.14
5.4.410.0140.02516.01
5.4.400.0070.04715.88
5.4.390.0100.04316.02
5.4.380.0110.03915.83
5.4.370.0070.02716.02
5.4.360.0040.04615.89
5.4.350.0070.04515.85
5.4.340.0070.04616.01
5.4.330.0170.00512.70
5.4.320.0130.04316.13
5.4.310.0110.02815.83
5.4.300.0120.04715.83
5.4.290.0140.04016.00
5.4.280.0070.03116.02
5.4.270.0100.03816.08
5.4.260.0190.03215.88
5.4.250.0110.03615.88
5.4.240.0130.04116.18
5.4.230.0100.04015.85
5.4.220.0100.04515.97
5.4.210.0100.04216.06
5.4.200.0080.03815.95
5.4.190.0070.04216.04
5.4.180.0150.02515.92
5.4.170.0140.04016.02
5.4.160.0120.02615.98
5.4.150.0090.04315.89
5.4.140.0050.03014.71
5.4.130.0070.03614.72
5.4.120.0060.04114.72
5.4.110.0020.02714.58
5.4.100.0060.04214.70
5.4.90.0070.03814.66
5.4.80.0000.04714.67
5.4.70.0070.04014.59
5.4.60.0080.03514.63
5.4.50.0070.02214.68
5.4.40.0110.02414.65
5.4.30.0090.03314.72
5.4.20.0120.02714.58
5.4.10.0070.02514.65
5.4.00.0110.02614.52
5.3.290.0100.04814.21
5.3.280.0140.03714.19
5.3.270.0110.04614.15
5.3.260.0150.04114.30
5.3.250.0030.04514.20
5.3.240.0030.04614.11
5.3.230.0090.04114.23
5.3.220.0040.04614.18
5.3.210.0040.04714.18
5.3.200.0090.04614.18
5.3.190.0080.04314.21
5.3.180.0070.04514.17
5.3.170.0120.04014.18
5.3.160.0090.03814.24
5.3.150.0100.04714.24
5.3.140.0120.03914.19
5.3.130.0110.02514.11
5.3.120.0090.02614.18
5.3.110.0090.04214.12
5.3.100.0080.02614.11
5.3.90.0060.02614.20
5.3.80.0100.02714.08
5.3.70.0080.02414.15
5.3.60.0070.02714.17
5.3.50.0080.02614.12
5.3.40.0080.02714.11
5.3.30.0070.02614.18
5.3.20.0040.02514.20
5.3.10.0030.03414.06
5.3.00.0060.02514.11
5.2.170.0090.02013.62
5.2.160.0080.02013.65
5.2.150.0140.01313.61
5.2.140.0040.02113.59
5.2.130.0080.02313.65
5.2.120.0040.02113.76
5.2.110.0010.03313.71
5.2.100.0060.02413.61
5.2.90.0030.02413.58
5.2.80.0070.02513.63
5.2.70.0100.01513.63
5.2.60.0020.02313.57
5.2.50.0040.02013.54
5.2.40.0070.02113.54
5.2.30.0050.01913.59
5.2.20.0050.03913.51
5.2.10.0100.02013.47
5.2.00.0030.02013.48
5.1.60.0080.01413.47
5.1.50.0030.01913.47
5.1.40.0030.01713.47
5.1.30.0080.01713.47
5.1.20.0070.01613.47
5.1.10.0050.01813.47
5.1.00.0040.01813.47
5.0.50.0030.01513.47
5.0.40.0050.01713.47
5.0.30.0030.02313.47
5.0.20.0050.01413.47
5.0.10.0040.01613.47
5.0.00.0050.01713.47
4.4.90.0050.01713.47
4.4.80.0000.01813.47
4.4.70.0010.01513.47
4.4.60.0010.01113.47
4.4.50.0000.01113.47
4.4.40.0030.02213.47
4.4.30.0020.01013.47
4.4.20.0060.01013.47
4.4.10.0030.00813.47
4.4.00.0040.01713.47
4.3.110.0030.00813.47
4.3.100.0030.00813.47
4.3.90.0000.01213.47
4.3.80.0010.01513.47
4.3.70.0020.01813.47
4.3.60.0010.01513.47
4.3.50.0030.01013.47
4.3.40.0010.01313.47
4.3.30.0000.01113.47
4.3.20.0000.01313.47
4.3.10.0020.00913.47
4.3.00.0010.00813.47

preferences:
44.4 ms | 400 KiB | 5 Q