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); /**/var_dump($full_string_ascii, $match_ascii, $start, $length); 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.60.0180.00016.75
8.3.50.0090.00722.26
8.3.40.0120.00319.04
8.3.30.0070.01119.23
8.3.20.0080.00020.20
8.3.10.0040.00423.48
8.3.00.0090.00020.99
8.2.180.0060.00916.75
8.2.170.0120.00322.96
8.2.160.0140.00320.27
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0040.01126.16
8.2.120.0040.00422.18
8.2.110.0050.00520.46
8.2.100.0040.00818.12
8.2.90.0000.00819.30
8.2.80.0090.00317.97
8.2.70.0100.00317.50
8.2.60.0000.00918.04
8.2.50.0050.00318.07
8.2.40.0030.00618.47
8.2.30.0000.00718.32
8.2.20.0000.00818.00
8.2.10.0000.00817.97
8.2.00.0040.00418.02
8.1.280.0130.00625.92
8.1.270.0050.00322.14
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00322.06
8.1.230.0040.00817.77
8.1.220.0040.00417.91
8.1.210.0030.00618.77
8.1.200.0090.00017.50
8.1.190.0040.00417.78
8.1.180.0040.00418.10
8.1.170.0050.00318.69
8.1.160.0040.00421.96
8.1.150.0070.00018.76
8.1.140.0060.00317.54
8.1.130.0000.00818.03
8.1.120.0040.00417.67
8.1.110.0000.00917.60
8.1.100.0050.00317.52
8.1.90.0040.00417.63
8.1.80.0000.00717.50
8.1.70.0070.00017.43
8.1.60.0000.00817.80
8.1.50.0060.00317.63
8.1.40.0030.00617.81
8.1.30.0000.00817.78
8.1.20.0080.00017.91
8.1.10.0040.00417.68
8.1.00.0070.00317.75
8.0.300.0040.00418.77
8.0.290.0070.00417.00
8.0.280.0070.00018.46
8.0.270.0040.00417.25
8.0.260.0050.00317.09
8.0.250.0000.00717.30
8.0.240.0000.00717.21
8.0.230.0040.00417.13
8.0.220.0000.00717.11
8.0.210.0050.00217.22
8.0.200.0000.00817.12
8.0.190.0000.00717.22
8.0.180.0040.00417.17
8.0.170.0020.00517.09
8.0.160.0000.00717.24
8.0.150.0020.00517.21
8.0.140.0070.00017.13
8.0.130.0030.00313.46
8.0.120.0040.00417.37
8.0.110.0000.00917.34
8.0.100.0000.00917.33
8.0.90.0060.00317.30
8.0.80.0130.01217.30
8.0.70.0060.00317.31
8.0.60.0040.00717.32
8.0.50.0030.00617.14
8.0.30.0120.00917.45
8.0.20.0150.00517.42
8.0.10.0080.00317.30
8.0.00.0110.01217.05
7.4.330.0050.00015.11
7.4.320.0000.00616.77
7.4.300.0030.00316.91
7.4.290.0040.00416.77
7.4.280.0000.01116.82
7.4.270.0030.00316.78
7.4.260.0040.00416.86
7.4.250.0050.00516.80
7.4.240.0000.00916.94
7.4.230.0080.00017.11
7.4.220.0130.01017.09
7.4.210.0090.01216.96
7.4.200.0000.00916.80
7.4.190.0000.00816.84
7.4.160.0030.01616.68
7.4.150.0120.00817.40
7.4.140.0130.00817.86
7.4.130.0110.00816.90
7.4.120.0070.01416.87
7.4.110.0030.01516.81
7.4.100.0120.01216.99
7.4.90.0150.00616.86
7.4.80.0070.01419.39
7.4.70.0190.00916.77
7.4.60.0050.01816.82
7.4.50.0080.00716.74
7.4.40.0050.01619.59
7.4.30.0160.00616.61
7.4.20.0070.01516.34
7.4.10.0080.01515.89
7.4.00.0130.00815.85
7.3.330.0000.00513.44
7.3.320.0030.00313.42
7.3.310.0030.00516.61
7.3.300.0030.00516.71
7.3.290.0030.01316.73
7.3.280.0080.01516.70
7.3.270.0110.02017.40
7.3.260.0090.01216.70
7.3.250.0110.00716.76
7.3.240.0100.01416.79
7.3.230.0090.01216.89
7.3.210.0080.01216.84
7.3.200.0060.01316.72
7.3.190.0110.01216.68
7.3.180.0160.00616.78
7.3.170.0160.00616.72
7.3.160.0060.01516.87
7.3.150.0230.00616.71
7.3.140.0110.01016.56
7.3.130.0110.01015.93
7.3.120.0080.01015.77
7.3.110.0120.00915.88
7.3.100.0100.01415.89
7.3.90.0150.00516.08
7.3.80.0030.01215.89
7.3.70.0060.01815.96
7.3.60.0070.01215.86
7.3.50.0080.01315.99
7.3.40.0120.00915.98
7.3.30.0060.01515.95
7.3.20.0070.01317.70
7.3.10.0130.00717.76
7.3.00.0080.00817.63
7.2.330.0090.01217.07
7.2.320.0110.00817.06
7.2.310.0110.01116.98
7.2.300.0130.00816.98
7.2.290.0100.01417.00
7.2.280.0190.00316.91
7.2.270.0150.00916.70
7.2.260.0120.00916.10
7.2.250.0080.01316.26
7.2.240.0130.00916.34
7.2.230.0090.01216.13
7.2.220.0090.01116.15
7.2.210.0100.01016.06
7.2.200.0070.00916.11
7.2.190.0090.01416.17
7.2.180.0100.00815.87
7.2.170.0110.01016.00
7.2.160.0050.01915.96
7.2.150.0080.01718.01
7.2.140.0090.01117.94
7.2.130.0110.00717.60
7.2.120.0080.01317.66
7.2.110.0080.00917.73
7.2.100.0090.01317.73
7.2.90.0080.01317.74
7.2.80.0050.01417.71
7.2.70.0120.00917.69
7.2.60.0080.01317.54
7.2.50.0040.01117.57
7.2.40.0050.01417.68
7.2.30.0080.01017.82
7.2.20.0120.00717.84
7.2.10.0060.01217.75
7.2.00.0070.01118.27
7.1.330.0140.01217.11
7.1.320.0160.01016.89
7.1.310.0110.01217.08
7.1.300.0180.00916.93
7.1.290.0120.01116.94
7.1.280.0140.01316.71
7.1.270.0200.00616.86
7.1.260.0200.00916.88
7.1.250.0120.00916.65
7.1.240.0120.01216.73
7.1.230.0130.01116.64
7.1.220.0100.00916.77
7.1.210.0110.00916.72
7.1.200.0070.01316.48
7.1.190.0150.00716.56
7.1.180.0100.01216.67
7.1.170.0100.01016.74
7.1.160.0090.00916.64
7.1.150.0130.00616.63
7.1.140.0100.01016.75
7.1.130.0150.00716.74
7.1.120.0070.01316.62
7.1.110.0120.00916.74
7.1.100.0080.01017.13
7.1.90.0140.00416.65
7.1.80.0100.00816.72
7.1.70.0090.01116.75
7.1.60.0110.01217.42
7.1.50.0130.01016.92
7.1.40.0100.01016.67
7.1.30.0100.01616.68
7.1.20.0130.01416.59
7.1.10.0100.00916.74
7.1.00.0080.02818.17
7.0.330.0130.00716.18
7.0.320.0120.00816.25
7.0.310.0090.01316.33
7.0.300.0110.01016.36
7.0.290.0110.01016.12
7.0.280.0090.01516.27
7.0.270.0150.00516.16
7.0.260.0100.01116.31
7.0.250.0140.00816.29
7.0.240.0130.00916.38
7.0.230.0100.00816.21
7.0.220.0100.01216.24
7.0.210.0100.00916.24
7.0.200.0150.00916.43
7.0.190.0110.01116.13
7.0.180.0190.01616.23
7.0.170.0160.01716.28
7.0.160.0150.00616.34
7.0.150.0170.00816.25
7.0.140.0090.02417.81
7.0.130.0100.01216.38
7.0.120.0110.01116.28
7.0.110.0090.01316.45
7.0.100.0170.02817.09
7.0.90.0170.02717.21
7.0.80.0200.02817.18
7.0.70.0190.02517.03
7.0.60.0180.02417.16
7.0.50.0160.02917.31
7.0.40.0080.02516.34
7.0.30.0120.02016.29
7.0.20.0090.02916.34
7.0.10.0120.01916.40
7.0.00.0160.02616.35
5.6.400.0150.01215.44
5.6.390.0170.01215.36
5.6.380.0100.01015.26
5.6.370.0110.01315.22
5.6.360.0150.00715.15
5.6.350.0140.00515.17
5.6.340.0070.01515.45
5.6.330.0080.01315.37
5.6.320.0130.00915.25
5.6.310.0110.01115.06
5.6.300.0150.00715.18
5.6.290.0100.00915.18
5.6.280.0120.02716.57
5.6.270.0130.01115.20
5.6.260.0090.01315.16
5.6.250.0140.02316.48
5.6.240.0110.02516.58
5.6.230.0140.02316.58
5.6.220.0110.02716.53
5.6.210.0130.02416.54
5.6.200.0090.03116.68
5.6.190.0100.02816.91
5.6.180.0110.02316.60
5.6.170.0120.02316.65
5.6.160.0100.03116.63
5.6.150.0090.02316.54
5.6.140.0070.03116.67
5.6.130.0090.02416.59
5.6.120.0110.02416.64
5.6.110.0110.02616.55
5.6.100.0120.01916.74
5.6.90.0090.03116.78
5.6.80.0060.02216.48
5.6.70.0080.02016.45
5.6.60.0100.02116.37
5.6.50.0160.02216.42
5.6.40.0090.02616.47
5.6.30.0100.02816.55
5.6.20.0060.02116.40
5.6.10.0130.01216.49
5.6.00.0120.02216.41
5.5.380.0080.02515.56
5.5.370.0140.02315.53
5.5.360.0100.02915.59
5.5.350.0080.02115.59
5.5.340.0110.02715.73
5.5.330.0100.01715.77
5.5.320.0080.02015.85
5.5.310.0110.02715.61
5.5.300.0110.02715.76
5.5.290.0090.01915.64
5.5.280.0120.02215.68
5.5.270.0120.02415.71
5.5.260.0110.02815.82
5.5.250.0100.02615.70
5.5.240.0090.02115.50
5.5.230.0110.01715.57
5.5.220.0100.02415.42
5.5.210.0100.01615.48
5.5.200.0110.02315.58
5.5.190.0070.02815.58
5.5.180.0120.02515.59
5.5.170.0120.00513.99
5.5.160.0080.02915.60
5.5.150.0090.02715.63
5.5.140.0090.02715.48
5.5.130.0090.01615.44
5.5.120.0110.02215.51
5.5.110.0110.02415.57
5.5.100.0050.02215.51
5.5.90.0100.02615.49
5.5.80.0050.02415.44
5.5.70.0080.02815.49
5.5.60.0120.02515.45
5.5.50.0110.02215.35
5.5.40.0110.02415.43
5.5.30.0100.02515.54
5.5.20.0070.02715.45
5.5.10.0050.02615.46
5.5.00.0090.02215.46
5.4.450.0090.02614.09
5.4.440.0110.02214.04
5.4.430.0070.01614.10
5.4.420.0100.02514.10
5.4.410.0080.02314.18
5.4.400.0080.01413.96
5.4.390.0080.01913.94
5.4.380.0050.02613.88
5.4.370.0100.02213.99
5.4.360.0050.01713.92
5.4.350.0080.02414.04
5.4.340.0090.01313.97
5.4.330.0090.00512.14
5.4.320.0130.02114.03
5.4.310.0090.02013.93
5.4.300.0100.02213.91
5.4.290.0060.01713.95
5.4.280.0070.02413.88
5.4.270.0100.02014.00
5.4.260.0070.02313.99
5.4.250.0060.02713.90
5.4.240.0080.02113.93
5.4.230.0070.02413.97
5.4.220.0090.02214.01
5.4.210.0070.02313.91
5.4.200.0070.01313.89
5.4.190.0080.01913.93
5.4.180.0100.01614.00
5.4.170.0100.02313.93
5.4.160.0090.01913.96
5.4.150.0060.01813.90
5.4.140.0070.02213.34
5.4.130.0090.02013.26
5.4.120.0050.02313.28
5.4.110.0090.01313.31
5.4.100.0070.02313.31
5.4.90.0070.01813.28
5.4.80.0080.01813.35
5.4.70.0090.01913.33
5.4.60.0060.02413.29
5.4.50.0050.02313.38
5.4.40.0040.02613.32
5.4.30.0070.02413.30
5.4.20.0060.02013.30
5.4.10.0070.02413.23
5.4.00.0050.02513.11
5.3.290.0080.01613.04
5.3.280.0100.02613.00
5.3.270.0070.02312.96
5.3.260.0180.02013.00
5.3.250.0080.02113.02
5.3.240.0050.02813.01
5.3.230.0080.02612.97
5.3.220.0080.02312.95
5.3.210.0070.02312.95
5.3.200.0100.02012.97
5.3.190.0110.01512.98
5.3.180.0070.02513.04
5.3.170.0080.02313.02
5.3.160.0070.02013.00
5.3.150.0080.02112.96
5.3.140.0100.02213.03
5.3.130.0050.02412.96
5.3.120.0110.02212.96
5.3.110.0070.02512.97
5.3.100.0100.02112.84
5.3.90.0080.02512.90
5.3.80.0060.02412.81
5.3.70.0090.02312.84
5.3.60.0090.02512.88
5.3.50.0060.02612.79
5.3.40.0090.02212.84
5.3.30.0070.02612.81
5.3.20.0070.02512.80
5.3.10.0080.02512.69
5.3.00.0050.02612.67
5.2.170.0060.02111.68
5.2.160.0080.02211.68
5.2.150.0070.01811.68
5.2.140.0100.02411.69
5.2.130.0060.02311.65
5.2.120.0070.02611.68
5.2.110.0050.02811.72
5.2.100.0090.01611.67
5.2.90.0070.02711.74
5.2.80.0080.02411.63
5.2.70.0080.02311.68
5.2.60.0100.02411.67
5.2.50.0050.03011.68
5.2.40.0030.02511.67
5.2.30.0050.02811.60
5.2.20.0070.02711.60
5.2.10.0050.02711.62
5.2.00.0040.02711.58
5.1.60.0080.01811.57
5.1.50.0110.01311.57
5.1.40.0050.01511.57
5.1.30.0030.01711.57
5.1.20.0050.01811.57
5.1.10.0050.01411.57
5.1.00.0060.01311.57
5.0.50.0040.01211.57
5.0.40.0050.01111.57
5.0.30.0050.01411.57
5.0.20.0050.01111.57
5.0.10.0040.01311.57
5.0.00.0020.01711.57
4.4.90.0020.01511.57
4.4.80.0030.01311.57
4.4.70.0030.01311.57
4.4.60.0040.00811.57
4.4.50.0040.01311.57
4.4.40.0040.01511.57
4.4.30.0050.01011.57
4.4.20.0060.00411.57
4.4.10.0010.00911.57
4.4.00.0010.01211.57
4.3.110.0030.00611.57
4.3.100.0030.00811.57
4.3.90.0030.00811.57
4.3.80.0030.01011.57
4.3.70.0020.00711.57
4.3.60.0020.00811.57
4.3.50.0040.00711.57
4.3.40.0020.01111.57
4.3.30.0030.00511.57
4.3.20.0010.00811.57
4.3.10.0000.01011.57
4.3.00.0020.00711.57

preferences:
73.05 ms | 401 KiB | 5 Q