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){ /**/var_dump(preg_replace('/[^\w]/i', '', iconv('UTF-8', 'ASCII//TRANSLIT', $matches[0]))); 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.70.0120.00918.68
8.3.60.0070.01118.65
8.3.50.0050.01416.88
8.3.40.0100.01419.22
8.3.30.0040.01119.08
8.3.20.0080.00019.02
8.3.10.0080.00018.96
8.3.00.0040.00419.51
8.2.180.0090.00617.13
8.2.170.0070.01122.96
8.2.160.0070.00720.48
8.2.150.0070.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0070.01121.24
8.2.110.0060.00322.23
8.2.100.0040.00818.16
8.2.90.0040.00418.00
8.2.80.0030.00618.80
8.2.70.0030.00617.88
8.2.60.0040.00417.93
8.2.50.0000.00818.07
8.2.40.0030.00619.85
8.2.30.0040.00418.08
8.2.20.0000.01017.87
8.2.10.0050.00317.96
8.2.00.0030.00617.84
8.1.280.0140.00725.92
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0030.00628.09
8.1.240.0050.00522.67
8.1.230.0000.01120.97
8.1.220.0060.00317.77
8.1.210.0040.00418.77
8.1.200.0000.01017.61
8.1.190.0050.00317.48
8.1.180.0040.00419.44
8.1.170.0030.00518.95
8.1.160.0000.00819.15
8.1.150.0070.00018.85
8.1.140.0040.00417.57
8.1.130.0040.00419.45
8.1.120.0000.00817.62
8.1.110.0000.00817.59
8.1.100.0040.00417.52
8.1.90.0040.00417.60
8.1.80.0000.00717.50
8.1.70.0030.00517.57
8.1.60.0050.00317.72
8.1.50.0030.00617.58
8.1.40.0040.00417.67
8.1.30.0050.00317.86
8.1.20.0000.00917.82
8.1.10.0040.00417.84
8.1.00.0040.00417.69
8.0.300.0000.00718.77
8.0.290.0000.00817.00
8.0.280.0000.00718.59
8.0.270.0030.00317.33
8.0.260.0000.00717.21
8.0.250.0000.00817.19
8.0.240.0000.00917.13
8.0.230.0070.00017.14
8.0.220.0000.00717.20
8.0.210.0000.00817.10
8.0.200.0000.00717.09
8.0.190.0040.00417.26
8.0.180.0060.00317.19
8.0.170.0040.00717.10
8.0.160.0000.00817.21
8.0.150.0030.00617.13
8.0.140.0030.00617.16
8.0.130.0030.00313.49
8.0.120.0000.00917.36
8.0.110.0030.00617.26
8.0.100.0040.00417.33
8.0.90.0030.00617.16
8.0.80.0100.01017.35
8.0.70.0040.00417.37
8.0.60.0040.00717.21
8.0.50.0040.00717.23
8.0.30.0120.00817.71
8.0.20.0090.01117.30
8.0.10.0090.00017.33
8.0.00.0090.01517.29
7.4.330.0020.00213.19
7.4.320.0050.00316.90
7.4.300.0030.00316.80
7.4.290.0030.00316.78
7.4.280.0040.00416.79
7.4.270.0030.00316.83
7.4.260.0000.00513.51
7.4.250.0000.00917.00
7.4.240.0000.00917.06
7.4.230.0000.01416.66
7.4.220.0130.01317.06
7.4.210.0040.01416.96
7.4.200.0100.00017.01
7.4.190.0000.00817.04
7.4.160.0140.00416.91
7.4.150.0060.01516.81
7.4.140.0140.01416.73
7.4.130.0040.01616.94
7.4.120.0070.01116.89
7.4.110.0220.00316.68
7.4.100.0100.01016.84
7.4.90.0040.01916.83
7.4.80.0200.00019.39
7.4.70.0210.01716.89
7.4.60.0150.00716.80
7.4.50.0070.01016.70
7.4.40.0140.00616.69
7.4.30.0120.01916.63
7.4.20.0150.00916.81
7.4.10.0130.01315.76
7.4.00.0090.01115.95
7.3.330.0030.00313.44
7.3.320.0000.00613.35
7.3.310.0000.00816.74
7.3.300.0030.00616.67
7.3.290.0100.00816.68
7.3.280.0060.01416.69
7.3.270.0060.01316.95
7.3.260.0120.00816.84
7.3.250.0160.00616.81
7.3.240.0100.01016.72
7.3.230.0140.00417.02
7.3.210.0120.01316.86
7.3.200.0080.01216.72
7.3.190.0130.01216.77
7.3.180.0120.01016.67
7.3.170.0110.01116.63
7.3.160.0150.00816.74
7.3.150.0080.01716.63
7.3.140.0160.00916.84
7.3.130.0120.01415.84
7.3.120.0120.00915.71
7.3.110.0080.01115.84
7.3.100.0140.00615.81
7.3.90.0130.00715.60
7.3.80.0120.00915.71
7.3.70.0090.00915.74
7.3.60.0100.00815.62
7.3.50.0100.00815.58
7.3.40.0100.00615.58
7.3.30.0070.01115.53
7.3.20.0080.01116.84
7.3.10.0100.01016.97
7.3.00.0100.00816.98
7.2.330.0100.01016.88
7.2.320.0130.01317.07
7.2.310.0140.01216.84
7.2.300.0130.01416.92
7.2.290.0110.01316.98
7.2.280.0120.01516.66
7.2.270.0230.01116.96
7.2.260.0110.01216.22
7.2.250.0080.01416.31
7.2.240.0090.01015.95
7.2.230.0140.00715.95
7.2.220.0090.01415.78
7.2.210.0100.00916.00
7.2.200.0110.01015.80
7.2.190.0090.01115.88
7.2.180.0080.01215.85
7.2.170.0120.01015.89
7.2.160.0100.01115.76
7.2.150.0080.01117.15
7.2.140.0120.01017.10
7.2.130.0090.01117.17
7.2.120.0090.00917.09
7.2.110.0150.00917.10
7.2.100.0100.01217.12
7.2.90.0110.01017.16
7.2.80.0120.01017.31
7.2.70.0110.01217.08
7.2.60.0310.00916.76
7.2.50.0090.01517.10
7.2.40.0170.00817.25
7.2.30.0100.01517.17
7.2.20.0110.01317.16
7.2.10.0130.01017.15
7.2.00.0080.01217.91
7.1.330.0090.00616.16
7.1.320.0090.00916.16
7.1.310.0050.01116.06
7.1.300.0070.01215.99
7.1.290.0070.00816.15
7.1.280.0120.00616.03
7.1.270.0060.01216.08
7.1.260.0120.01016.00
7.1.250.0130.00916.01
7.1.240.0130.01216.07
7.1.230.0080.00816.09
7.1.220.0050.01516.14
7.1.210.0120.00515.96
7.1.200.0110.00716.11
7.1.190.0060.01316.17
7.1.180.0120.01116.01
7.1.170.0170.00716.02
7.1.160.0070.00915.89
7.1.150.0080.01116.04
7.1.140.0270.01416.05
7.1.130.0140.01315.96
7.1.120.0120.01215.85
7.1.110.0150.01116.05
7.1.100.0290.01216.12
7.1.90.0180.01316.07
7.1.80.0230.00516.17
7.1.70.0120.01116.58
7.1.60.0140.01217.01
7.1.50.0160.00816.60
7.1.40.0170.01316.07
7.1.30.0180.00916.11
7.1.20.0180.00915.97
7.1.10.0210.01015.92
7.1.00.0100.02518.28
7.0.330.0140.01015.70
7.0.320.0090.01115.73
7.0.310.0170.00515.70
7.0.300.0160.01415.65
7.0.290.0100.00715.72
7.0.280.0100.01215.62
7.0.270.0160.01115.59
7.0.260.0180.00615.65
7.0.250.0170.01115.64
7.0.240.0190.00915.79
7.0.230.0160.00915.75
7.0.220.0160.01115.76
7.0.210.0140.01515.72
7.0.200.0100.00816.04
7.0.190.0170.01115.59
7.0.180.0180.00915.60
7.0.170.0150.00915.71
7.0.160.0140.01015.78
7.0.150.0170.01215.72
7.0.140.0140.03117.81
7.0.130.0190.00815.59
7.0.120.0130.03017.86
7.0.110.0190.00515.73
7.0.100.0170.01215.67
7.0.90.0120.01115.79
7.0.80.0110.01115.76
7.0.70.0110.01115.84
7.0.60.0130.03117.14
7.0.50.0120.03016.39
7.0.40.0120.03416.49
7.0.30.0140.03116.60
7.0.20.0170.03716.46
7.0.10.0140.03216.57
7.0.00.0150.03016.66
5.6.400.0120.01315.32
5.6.390.0110.01215.52
5.6.380.0090.01315.57
5.6.370.0070.01415.48
5.6.360.0130.01615.26
5.6.350.0090.01315.37
5.6.340.0060.01415.28
5.6.330.0180.00915.51
5.6.320.0170.01015.64
5.6.310.0180.01315.49
5.6.300.0180.01215.46
5.6.290.0220.00715.48
5.6.280.0100.03417.38
5.6.270.0170.01015.55
5.6.260.0110.01615.52
5.6.250.0140.01115.65
5.6.240.0120.01415.42
5.6.230.0100.01215.54
5.6.220.0120.01215.50
5.6.210.0090.03817.08
5.6.200.0150.02016.52
5.6.190.0120.02417.19
5.6.180.0160.02317.23
5.6.170.0170.02917.29
5.6.160.0150.03317.23
5.6.150.0120.03416.41
5.6.140.0050.02616.47
5.6.130.0100.03816.44
5.6.120.0120.03217.35
5.6.110.0140.03217.41
5.6.100.0160.02117.37
5.6.90.0090.03817.26
5.6.80.0110.02317.07
5.6.70.1250.01417.15
5.6.60.0130.01215.31
5.6.50.0080.01515.21
5.6.40.0110.01215.38
5.6.30.0180.00815.29
5.6.20.0120.01015.35
5.6.10.0110.01715.35
5.6.00.0120.01015.26
5.5.380.0160.00815.53
5.5.370.0200.00515.32
5.5.360.0090.01715.38
5.5.350.0200.03017.12
5.5.340.0130.03116.39
5.5.330.0130.02517.02
5.5.320.0240.03317.18
5.5.310.0170.02517.02
5.5.300.0110.03516.23
5.5.290.0130.02416.46
5.5.280.0080.03217.29
5.5.270.0120.03617.18
5.5.260.0150.02817.44
5.5.250.0140.02917.11
5.5.240.0120.02116.98
5.5.230.0150.00915.46
5.5.220.0120.01215.20
5.5.210.0110.01215.41
5.5.200.0110.01515.38
5.5.190.0150.01015.40
5.5.180.0100.01515.35
5.5.170.0190.00715.38
5.5.160.0140.01015.21
5.5.150.0100.01615.25
5.5.140.0120.01415.29
5.5.130.0150.00815.44
5.5.120.0180.00415.32
5.5.110.0140.00915.27
5.5.100.0100.01415.27
5.5.90.0120.01115.27
5.5.80.0170.00815.21
5.5.70.0150.01315.24
5.5.60.0130.01715.43
5.5.50.0100.01115.28
5.5.40.0160.00915.40
5.5.30.0170.00415.31
5.5.20.0150.01215.28
5.5.10.0110.01515.10
5.5.00.0140.01015.26
5.4.450.0090.01914.73
5.4.440.0090.01914.73
5.4.430.0120.02614.65
5.4.420.0100.02314.79
5.4.410.0090.02014.69
5.4.400.0120.01714.67
5.4.390.0070.02214.67
5.4.380.0060.02114.66
5.4.370.0080.02914.67
5.4.360.0070.02114.56
5.4.350.0100.01614.59
5.4.340.0080.02114.65
5.4.330.0110.00312.32
5.4.320.0090.02014.56
5.4.310.0110.01914.61
5.4.300.0070.01914.50
5.4.290.0070.01814.68
5.4.280.0070.01814.61
5.4.270.0120.01714.73
5.4.260.0120.01714.54
5.4.250.0080.02914.52
5.4.240.0080.01814.61
5.4.230.0100.01714.67
5.4.220.0080.02814.64
5.4.210.0080.03314.61
5.4.200.0080.02014.63
5.4.190.0110.02914.50
5.4.180.0120.02414.55
5.4.170.0110.02314.50
5.4.160.0100.02814.57
5.4.150.0140.02514.59
5.4.140.0120.01613.72
5.4.130.0100.02713.68
5.4.120.0090.02413.67
5.4.110.0070.02913.71
5.4.100.0080.01813.78
5.4.90.0100.03013.67
5.4.80.0130.01613.74
5.4.70.0120.01613.74
5.4.60.0070.02013.82
5.4.50.0100.02513.78
5.4.40.0080.01613.71
5.4.30.0120.01413.74
5.4.20.0090.02213.73
5.4.10.0040.02613.69
5.4.00.0080.03113.55
5.3.290.0100.02213.41
5.3.280.0070.03013.30
5.3.270.0100.02613.43
5.3.260.0030.02913.34
5.3.250.0120.03013.38
5.3.240.0120.01813.30
5.3.230.0050.02513.36
5.3.220.0090.01913.28
5.3.210.0080.02313.29
5.3.200.0060.03213.32
5.3.190.0110.03013.35
5.3.180.0070.02613.39
5.3.170.0110.03013.32
5.3.160.0090.02113.39
5.3.150.0090.02313.34
5.3.140.0100.02313.33
5.3.130.0070.03413.28
5.3.120.0070.03013.25
5.3.110.0060.02613.28
5.3.100.0060.02613.15
5.3.90.0060.02013.15
5.3.80.0060.02513.08
5.3.70.0090.02213.08
5.3.60.0100.02313.14
5.3.50.0100.02213.06
5.3.40.0080.01813.12
5.3.30.0080.01913.12
5.3.20.0090.02713.06
5.3.10.0050.02712.90
5.3.00.0110.01712.93
5.2.170.0090.03911.81
5.2.160.0070.02111.83
5.2.150.0100.01911.86
5.2.140.0110.03311.77
5.2.130.0120.02511.73
5.2.120.0100.03311.76
5.2.110.0110.01811.80
5.2.100.0190.03011.79
5.2.90.0110.03011.71
5.2.80.0110.03811.71
5.2.70.0060.03911.77
5.2.60.0120.02911.66
5.2.50.0050.03611.70
5.2.40.0060.02111.59
5.2.30.0100.02711.54
5.2.20.0070.03411.60
5.2.10.0070.02311.56
5.2.00.0150.02211.40
5.1.60.0080.02210.99
5.1.50.0100.01511.03
5.1.40.0110.03011.00
5.1.30.0050.02811.20
5.1.20.0030.03811.24
5.1.10.0080.03311.08
5.1.00.0080.02511.14
5.0.50.0090.01510.27
5.0.40.0060.01910.19
5.0.30.0060.03110.10
5.0.20.0080.02010.14
5.0.10.0110.02010.12
5.0.00.0090.01710.11
4.4.90.0070.0089.89
4.4.80.0040.0129.89
4.4.70.0060.0189.89
4.4.60.0060.0139.89
4.4.50.0060.0179.89
4.4.40.0040.0249.89
4.4.30.0060.0089.89
4.4.20.0060.0169.89
4.4.10.0060.0179.89
4.4.00.0070.0259.89
4.3.110.0030.0209.89
4.3.100.0020.0149.89
4.3.90.0020.0129.89
4.3.80.0050.0159.89
4.3.70.0030.0129.89
4.3.60.0050.0109.89
4.3.50.0060.0189.89
4.3.40.0060.0189.89
4.3.30.0040.0159.89
4.3.20.0030.0169.89
4.3.10.0030.0129.89
4.3.00.0020.0119.89

preferences:
64.25 ms | 401 KiB | 5 Q