3v4l.org

run code in 300+ PHP versions simultaneously
<?php function highlight($text, $words) { preg_match_all ( '~[\w\'\"]+~', $words, $m ); if (! $m) return $text; $re = '~\\b(' . implode ( '|', $m [0] ) . ')\\b~i'; return preg_replace ( $re, '<em>$0</em>', $text ); } $text = "this is Mechanic's test"; $word = "Mechanic's"; echo highlight($text,$word); $text = 'this is Mechanic"s test'; $word = 'Mechanic"s'; echo "\n".highlight($text,$word); $text = 'this is Mechanics test'; $word = 'Mech'; echo "\n".highlight($text,$word); echo str_replace($words,"<em>$words</em>",$text) ;

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.0120.00316.75
8.3.50.0060.00916.75
8.3.40.0070.01118.86
8.3.30.0090.00618.88
8.3.20.0030.00520.16
8.3.10.0040.00421.90
8.3.00.0000.00919.63
8.2.180.0070.00716.75
8.2.170.0090.00622.96
8.2.160.0030.01720.39
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00420.92
8.2.120.0040.00726.35
8.2.110.0090.00019.18
8.2.100.0040.00718.22
8.2.90.0030.00619.17
8.2.80.0050.00318.05
8.2.70.0100.00017.86
8.2.60.0090.00018.04
8.2.50.0030.00618.10
8.2.40.0000.00820.42
8.2.30.0000.00821.16
8.2.20.0000.00818.05
8.2.10.0000.00718.16
8.2.00.0000.00718.16
8.1.280.0110.00425.92
8.1.270.0040.00422.05
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0040.00422.54
8.1.230.0120.00017.66
8.1.220.0000.00817.76
8.1.210.0050.00318.77
8.1.200.0030.00617.48
8.1.190.0040.00417.36
8.1.180.0000.00818.10
8.1.170.0050.00318.79
8.1.160.0000.00718.97
8.1.150.0000.00820.75
8.1.140.0000.00819.58
8.1.130.0000.00818.89
8.1.120.0040.00417.53
8.1.110.0080.00017.61
8.1.100.0000.00817.62
8.1.90.0040.00717.51
8.1.80.0000.00817.66
8.1.70.0080.00017.66
8.1.60.0040.00417.79
8.1.50.0040.00417.65
8.1.40.0030.00617.70
8.1.30.0040.00417.83
8.1.20.0060.00617.85
8.1.10.0000.00817.81
8.1.00.0050.00317.61
8.0.300.0000.00718.77
8.0.290.0040.00417.00
8.0.280.0070.00018.53
8.0.270.0090.00017.29
8.0.260.0080.00017.04
8.0.250.0030.00317.22
8.0.240.0000.00717.21
8.0.230.0050.00217.22
8.0.220.0030.00317.02
8.0.210.0050.00217.10
8.0.200.0000.00717.22
8.0.190.0050.00517.21
8.0.180.0080.00017.03
8.0.170.0030.00517.03
8.0.160.0050.00317.16
8.0.150.0070.00317.07
8.0.140.0070.00317.02
8.0.130.0060.00013.55
8.0.120.0000.00716.97
8.0.110.0000.00716.96
8.0.100.0000.00817.21
8.0.90.0040.00416.95
8.0.80.0060.00917.17
8.0.70.0000.00816.94
8.0.60.0000.00817.11
8.0.50.0000.00717.12
8.0.30.0090.00917.33
8.0.20.0120.01017.40
8.0.10.0040.00417.06
8.0.00.0120.00616.68
7.4.330.0000.00515.55
7.4.320.0000.00716.84
7.4.300.0030.00316.72
7.4.290.0030.00616.84
7.4.280.0030.00616.72
7.4.270.0000.00716.84
7.4.260.0030.00316.61
7.4.250.0040.00416.60
7.4.240.0030.00516.77
7.4.230.0040.00416.64
7.4.220.0130.00316.79
7.4.210.0090.00516.80
7.4.200.0030.00316.63
7.4.160.0110.00516.79
7.4.150.0110.00817.40
7.4.140.0070.01117.86
7.4.130.0130.01116.63
7.4.120.0130.00816.77
7.4.110.0160.00916.71
7.4.100.0070.01116.90
7.4.90.0070.01016.61
7.4.80.0130.01019.39
7.4.70.0030.01316.73
7.4.60.0060.01616.79
7.4.50.0070.01016.52
7.4.40.0060.00916.71
7.4.30.0140.00316.93
7.4.00.0110.00315.04
7.3.330.0080.00013.52
7.3.320.0050.00013.35
7.3.310.0040.00416.56
7.3.300.0070.00016.54
7.3.290.0030.00316.53
7.3.280.0080.00816.51
7.3.270.0100.00717.40
7.3.260.0120.00816.54
7.3.250.0120.01016.74
7.3.240.0130.00516.70
7.3.230.0090.00916.57
7.3.210.0070.01016.64
7.3.200.0100.00716.55
7.3.190.0100.00616.60
7.3.180.0090.00916.92
7.3.170.0060.01216.54
7.3.160.0070.01016.68
7.3.10.0070.01016.45
7.3.00.0060.00616.45
7.2.330.0120.00616.79
7.2.320.0120.00616.91
7.2.310.0090.00916.88
7.2.300.0100.00716.88
7.2.290.0150.00316.70
7.2.130.0040.01217.17
7.2.120.0030.00917.24
7.2.110.0080.00417.12
7.2.100.0060.00617.18
7.2.90.0000.01316.84
7.2.80.0100.00716.99
7.2.70.0000.01017.22
7.2.60.0110.00516.99
7.2.50.0060.00916.85
7.2.40.0030.01016.82
7.2.30.0120.00017.05
7.2.20.0090.00616.85
7.2.10.0070.01016.70
7.2.00.0060.00518.43
7.1.250.0110.00015.85
7.1.200.0070.00715.89
7.1.100.0000.01418.64
7.1.70.0080.00517.34
7.1.60.0220.00635.26
7.1.50.0160.02134.71
7.1.40.0210.00634.88
7.1.30.0140.01334.73
7.1.20.0140.01434.91
7.1.10.0000.01316.71
7.1.00.0030.01416.98
7.0.200.0040.01316.83
7.0.190.0030.01316.96
7.0.180.0030.01016.28
7.0.170.0120.00016.27
7.0.160.0000.01316.27
7.0.150.0000.01216.55
7.0.140.0000.01216.68
7.0.130.0040.01316.75
7.0.120.0100.00716.91
7.0.110.0040.00816.60
7.0.100.0080.00416.45
7.0.90.0160.00814.50
7.0.80.0090.00316.43
7.0.70.0050.00816.38
7.0.60.0060.01216.11
7.0.50.0040.00816.47
7.0.40.0030.01316.74
7.0.30.0080.00616.79
7.0.20.0000.01416.66
7.0.10.0060.00616.51
7.0.00.0040.00816.52

preferences:
42.94 ms | 401 KiB | 5 Q