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); /**/var_dump($full_string_ascii, $match_ascii); $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.0090.00919.04
8.3.30.0110.00719.14
8.3.20.0080.00018.91
8.3.10.0000.00821.21
8.3.00.0030.00623.69
8.2.170.0090.00622.96
8.2.160.0100.00720.55
8.2.150.0080.00024.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0040.00419.67
8.2.110.0090.00020.25
8.2.100.0090.00318.28
8.2.90.0040.00419.36
8.2.80.0040.00418.05
8.2.70.0080.00017.71
8.2.60.0040.00417.68
8.2.50.0040.00418.07
8.2.40.0070.00018.34
8.2.30.0040.00419.39
8.2.20.0040.00418.10
8.2.10.0000.00717.84
8.2.00.0050.00317.89
8.1.270.0000.00723.99
8.1.260.0130.00626.35
8.1.250.0060.00328.09
8.1.240.0070.00422.57
8.1.230.0090.00320.82
8.1.220.0040.00418.77
8.1.210.0000.00818.94
8.1.200.0060.00317.48
8.1.190.0000.01017.66
8.1.180.0000.00818.10
8.1.170.0000.00818.78
8.1.160.0030.00519.07
8.1.150.0000.00818.77
8.1.140.0060.00317.67
8.1.130.0030.00517.79
8.1.120.0050.00217.53
8.1.110.0100.00017.47
8.1.100.0050.00317.64
8.1.90.0000.00817.61
8.1.80.0000.00817.60
8.1.70.0040.00417.58
8.1.60.0000.00817.68
8.1.50.0080.00017.70
8.1.40.0060.00317.81
8.1.30.0060.00317.85
8.1.20.0000.00817.84
8.1.10.0040.00417.82
8.1.00.0000.00817.70
8.0.300.0030.00620.02
8.0.290.0000.00717.16
8.0.280.0000.00718.58
8.0.270.0070.00017.34
8.0.260.0000.00716.98
8.0.250.0040.00417.27
8.0.240.0040.00417.20
8.0.230.0040.00417.25
8.0.220.0050.00217.24
8.0.210.0040.00417.21
8.0.200.0000.00717.11
8.0.190.0050.00317.23
8.0.180.0050.00317.15
8.0.170.0030.00617.16
8.0.160.0030.00517.23
8.0.150.0000.00717.08
8.0.140.0100.00017.14
8.0.130.0090.00013.42
8.0.120.0030.00617.35
8.0.110.0090.00017.15
8.0.100.0030.00617.41
8.0.90.0030.00617.41
8.0.80.0060.01317.41
8.0.70.0000.00917.38
8.0.60.0040.00517.43
8.0.50.0030.00617.14
8.0.30.0090.01317.43
8.0.20.0080.01317.44
8.0.10.0000.00917.13
8.0.00.0090.01217.07
7.4.330.0030.00313.43
7.4.320.0030.00616.88
7.4.300.0000.00616.79
7.4.290.0080.00016.77
7.4.280.0070.00016.86
7.4.270.0040.00416.67
7.4.260.0030.00313.54
7.4.250.0060.00616.87
7.4.240.0000.00916.86
7.4.230.0030.00616.91
7.4.220.0170.00716.87
7.4.210.0100.00717.02
7.4.200.0000.00816.75
7.4.190.0040.00416.75
7.4.160.0070.01116.95
7.4.150.0130.00617.40
7.4.140.0150.00517.86
7.4.130.0190.01616.87
7.4.120.0110.00816.87
7.4.110.0140.00616.68
7.4.100.0150.00616.93
7.4.90.0100.01016.90
7.4.80.0100.01019.39
7.4.70.0090.01216.79
7.4.60.0140.00816.82
7.4.50.0020.01316.71
7.4.40.0060.01219.44
7.4.30.0110.01416.60
7.4.20.0000.01916.75
7.4.10.0140.00716.67
7.4.00.0080.01116.16
7.3.330.0030.00313.53
7.3.320.0030.00313.39
7.3.310.0030.00616.64
7.3.300.0060.00316.72
7.3.290.0030.02016.68
7.3.280.0080.01516.67
7.3.270.0060.01317.40
7.3.260.0140.00618.24
7.3.250.0100.01316.80
7.3.240.0130.00616.72
7.3.230.0040.01416.69
7.3.210.0150.01116.94
7.3.200.0070.01116.79
7.3.190.0110.00816.69
7.3.180.0120.00916.59
7.3.170.0070.01516.89
7.3.160.0100.01316.70
7.3.150.0120.00916.64
7.3.140.0150.00716.73
7.3.130.0150.01216.48
7.3.120.0060.01315.84
7.3.110.0070.01516.45
7.3.100.0110.01416.89
7.3.90.0160.00916.61
7.3.80.0080.01516.83
7.3.70.0150.00716.76
7.3.60.0130.00916.73
7.3.50.0150.00716.80
7.3.40.0140.00816.71
7.3.30.0160.00816.78
7.3.20.0070.01418.72
7.3.10.0100.01318.42
7.3.00.0130.01318.59
7.2.330.0100.01016.91
7.2.320.0100.01017.02
7.2.310.0070.01716.81
7.2.300.0080.01316.92
7.2.290.0200.00916.92
7.2.280.0090.01516.94
7.2.270.0130.01316.82
7.2.260.0130.00816.68
7.2.250.0160.00816.50
7.2.240.0300.00016.68
7.2.230.0170.01117.04
7.2.220.0140.01216.97
7.2.210.0220.00316.82
7.2.200.0120.00916.93
7.2.190.0060.01416.96
7.2.180.0080.01417.02
7.2.170.0150.00616.96
7.2.160.0060.01516.73
7.2.150.0180.00518.75
7.2.140.0120.00918.79
7.2.130.0220.00318.72
7.2.120.0090.01018.76
7.2.110.0090.01218.63
7.2.100.0040.01518.74
7.2.90.0130.00918.97
7.2.80.0070.01217.87
7.2.70.0100.01318.84
7.2.60.0070.01317.90
7.2.50.0060.01418.82
7.2.40.0150.00618.93
7.2.30.0130.00918.80
7.2.20.0070.01418.66
7.2.10.0070.01418.70
7.2.00.0090.00619.32
7.1.330.0160.01317.67
7.1.320.0150.00417.55
7.1.310.0040.01417.82
7.1.300.0210.00817.79
7.1.290.0190.01117.74
7.1.280.0120.00817.68
7.1.270.0150.00617.75
7.1.260.0160.01317.66
7.1.250.0230.00817.60
7.1.240.0160.01617.71
7.1.230.0140.00617.64
7.1.220.0070.01017.69
7.1.210.0030.01417.77
7.1.200.0050.01417.07
7.1.190.0100.01617.62
7.1.180.0100.01017.84
7.1.170.0180.00017.73
7.1.160.0220.00717.76
7.1.150.0190.01017.52
7.1.140.0160.01617.75
7.1.130.0110.01717.77
7.1.120.0250.00417.60
7.1.110.0210.01417.55
7.1.100.0080.01318.12
7.1.90.0130.01717.73
7.1.80.0140.01417.67
7.1.70.0100.01317.71
7.1.60.0150.00818.60
7.1.50.0040.01417.65
7.1.40.0110.00717.77
7.1.30.0180.01317.88
7.1.20.0130.00417.80
7.1.10.0110.00917.64
7.1.00.0090.04520.21
7.0.330.0160.00817.13
7.0.320.0060.01317.57
7.0.310.0180.00617.38
7.0.300.0190.01217.48
7.0.290.0260.00417.57
7.0.280.0220.00717.31
7.0.270.0230.00617.21
7.0.260.0230.01317.51
7.0.250.0200.01017.34
7.0.240.0240.00517.30
7.0.230.0240.00417.32
7.0.220.0160.01517.46
7.0.210.0270.00917.60
7.0.200.0040.00917.25
7.0.190.0120.00617.48
7.0.180.0160.01317.31
7.0.170.0120.01617.47
7.0.160.0120.01017.22
7.0.150.0180.00317.52
7.0.140.0140.04019.83
7.0.130.0220.00717.48
7.0.120.0180.01117.50
7.0.110.0220.00717.30
7.0.100.0220.01017.34
7.0.90.0160.01317.26
7.0.80.0220.01017.48
7.0.70.0110.04118.73
7.0.60.0130.03618.76
7.0.50.0120.05318.99
7.0.40.0140.04818.83
7.0.30.0160.04618.77
7.0.20.0130.04618.70
7.0.10.0170.04318.83
7.0.00.0070.04918.76
5.6.400.0200.01216.30
5.6.390.0150.01516.59
5.6.380.0030.01716.40
5.6.370.0180.00316.43
5.6.360.0190.01116.29
5.6.350.0140.01715.98
5.6.340.0230.00916.36
5.6.330.0100.02015.98
5.6.320.0210.01216.12
5.6.310.0250.00616.42
5.6.300.0110.01116.03
5.6.290.0230.00816.15
5.6.280.0170.04318.51
5.6.270.0240.00616.33
5.6.260.0240.01116.31
5.6.250.0310.00616.23
5.6.240.0000.02616.17
5.6.230.0130.01716.39
5.6.220.0100.03118.36
5.6.210.0090.04718.34
5.6.200.0210.04418.66
5.6.190.0080.05518.85
5.6.180.0160.04118.84
5.6.170.0130.05618.77
5.6.160.0140.03318.66
5.6.150.0110.04818.73
5.6.140.0130.05018.68
5.6.130.0240.03218.82
5.6.120.0190.04718.69
5.6.110.0130.04418.78
5.6.100.0110.04718.78
5.6.90.0120.04718.62
5.6.80.0130.04718.35
5.6.70.0080.03318.26
5.6.60.0140.04918.44
5.6.50.0120.04818.44
5.6.40.0130.04818.38
5.6.30.0110.04718.35
5.6.20.0110.05118.19
5.6.10.0130.04918.33
5.6.00.0070.04518.24
5.5.380.0170.01316.27
5.5.370.0140.01716.37
5.5.360.0140.02818.30
5.5.350.0130.04918.23
5.5.340.0120.05318.62
5.5.330.0150.03818.65
5.5.320.0130.05218.54
5.5.310.0120.05018.51
5.5.300.0080.05118.59
5.5.290.0190.04618.62
5.5.280.0140.04618.63
5.5.270.0180.04718.65
5.5.260.0100.03118.53
5.5.250.0200.04518.55
5.5.240.0120.04718.31
5.5.230.0150.04318.24
5.5.220.0130.04518.27
5.5.210.0140.04718.25
5.5.200.0140.04618.23
5.5.190.0130.02818.28
5.5.180.0090.05418.24
5.5.170.0210.01416.45
5.5.160.0090.04918.24
5.5.150.0120.03918.20
5.5.140.0120.04718.37
5.5.130.0110.04618.23
5.5.120.0130.04818.18
5.5.110.0180.03218.19
5.5.100.0130.05018.21
5.5.90.0110.05118.26
5.5.80.0110.04618.13
5.5.70.0100.03118.22
5.5.60.0120.03118.25
5.5.50.0110.03018.20
5.5.40.0110.02518.19
5.5.30.0130.02418.10
5.5.20.0110.02818.22
5.5.10.0120.03318.07
5.5.00.0080.02818.20
5.4.450.0100.03216.13
5.4.440.0120.03816.10
5.4.430.0160.03216.10
5.4.420.0110.04116.23
5.4.410.0100.04515.92
5.4.400.0100.03515.91
5.4.390.0110.04016.00
5.4.380.0060.04816.02
5.4.370.0100.03715.87
5.4.360.0070.03515.91
5.4.350.0070.04715.96
5.4.340.0150.04215.91
5.4.330.0160.00812.62
5.4.320.0080.04415.92
5.4.310.0120.04515.92
5.4.300.0100.04216.09
5.4.290.0100.04715.94
5.4.280.0190.03315.93
5.4.270.0090.03615.95
5.4.260.0100.04715.83
5.4.250.0090.03715.87
5.4.240.0120.02515.84
5.4.230.0070.03615.88
5.4.220.0050.04716.12
5.4.210.0140.02715.71
5.4.200.0060.02615.98
5.4.190.0090.02515.91
5.4.180.0120.02016.00
5.4.170.0100.02815.83
5.4.160.0110.03516.01
5.4.150.0070.02516.12
5.4.140.0070.02414.75
5.4.130.0080.01914.55
5.4.120.0090.02014.60
5.4.110.0110.03714.61
5.4.100.0060.02114.58
5.4.90.0110.02214.61
5.4.80.0090.02814.56
5.4.70.0100.02914.69
5.4.60.0070.02214.64
5.4.50.0070.02314.51
5.4.40.0060.02414.82
5.4.30.0080.03114.62
5.4.20.0110.02014.60
5.4.10.0120.02314.68
5.4.00.0120.01514.38
5.3.290.0030.05214.16
5.3.280.0100.03314.08
5.3.270.0120.02714.12
5.3.260.0070.02714.09
5.3.250.0120.01814.03
5.3.240.0090.02014.04
5.3.230.0050.02913.99
5.3.220.0090.02014.01
5.3.210.0110.04814.04
5.3.200.0150.03014.06
5.3.190.0110.02314.03
5.3.180.0050.03014.06
5.3.170.0110.02214.08
5.3.160.0130.02314.07
5.3.150.0090.02414.17
5.3.140.0080.02514.08
5.3.130.0120.03313.93
5.3.120.0100.02113.92
5.3.110.0060.02814.01
5.3.100.0060.03713.70
5.3.90.0120.02513.80
5.3.80.0110.02513.65
5.3.70.0110.02313.67
5.3.60.0090.02413.82
5.3.50.0050.03113.71
5.3.40.0090.01913.68
5.3.30.0140.03913.63
5.3.20.0080.02813.54
5.3.10.0090.03513.51
5.3.00.0100.02413.42
5.2.170.0080.02312.30
5.2.160.0070.02012.30
5.2.150.0070.02412.36
5.2.140.0080.02212.27
5.2.130.0090.02612.32
5.2.120.0070.01912.36
5.2.110.0080.02012.38
5.2.100.0110.01512.29
5.2.90.0060.02012.26
5.2.80.0110.02512.25
5.2.70.0070.04112.30
5.2.60.0100.02112.37
5.2.50.0080.01912.26
5.2.40.0060.03312.22
5.2.30.0080.02512.27
5.2.20.0070.01812.17
5.2.10.0090.02012.15
5.2.00.0090.01912.15
5.1.60.0030.02012.15
5.1.50.0100.01912.15
5.1.40.0050.02012.15
5.1.30.0050.01912.15
5.1.20.0050.02112.15
5.1.10.0090.01612.15
5.1.00.0070.02012.15
5.0.50.0070.02412.15
5.0.40.0080.02812.15
5.0.30.0040.03612.15
5.0.20.0040.02612.15
5.0.10.0050.03212.15
5.0.00.0070.03712.15
4.4.90.0040.00912.15
4.4.80.0070.00712.15
4.4.70.0060.00712.15
4.4.60.0040.00912.15
4.4.50.0030.01012.15
4.4.40.0040.02112.15
4.4.30.0030.01012.15
4.4.20.0020.01212.15
4.4.10.0060.01912.15
4.4.00.0040.02012.15
4.3.110.0030.02012.15
4.3.100.0030.02212.15
4.3.90.0050.01512.15
4.3.80.0040.02412.15
4.3.70.0040.01612.15
4.3.60.0030.01812.15
4.3.50.0060.01512.15
4.3.40.0060.02312.15
4.3.30.0030.01212.15
4.3.20.0060.01712.15
4.3.10.0050.01812.15
4.3.00.0050.01312.15

preferences:
43.72 ms | 400 KiB | 5 Q