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 "\n".str_replace($word,"<em>$word</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.0180.00416.88
8.3.50.0090.00916.75
8.3.40.0070.00719.03
8.3.30.0040.01218.64
8.3.20.0000.00820.34
8.3.10.0040.00423.65
8.3.00.0080.00019.38
8.2.180.0090.00616.63
8.2.170.0080.00822.96
8.2.160.0040.01120.43
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00721.14
8.2.120.0080.00026.35
8.2.110.0060.00321.16
8.2.100.0090.00318.22
8.2.90.0080.00019.34
8.2.80.0040.00418.05
8.2.70.0060.00317.63
8.2.60.0080.00018.05
8.2.50.0080.00018.10
8.2.40.0040.00420.62
8.2.30.0040.00421.12
8.2.20.0040.00418.17
8.2.10.0070.00018.07
8.2.00.0040.00418.09
8.1.280.0140.00025.92
8.1.270.0080.00022.18
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0040.00423.88
8.1.230.0040.00819.14
8.1.220.0040.00417.76
8.1.210.0000.00818.77
8.1.200.0090.00017.47
8.1.190.0090.00017.35
8.1.180.0000.00818.10
8.1.170.0040.00418.77
8.1.160.0040.00419.02
8.1.150.0050.00220.61
8.1.140.0040.00419.61
8.1.130.0030.00618.80
8.1.120.0030.00517.53
8.1.110.0030.00617.62
8.1.100.0090.00017.62
8.1.90.0070.00317.59
8.1.80.0020.00517.66
8.1.70.0000.00817.51
8.1.60.0060.00317.72
8.1.50.0000.00817.70
8.1.40.0040.00417.67
8.1.30.0050.00517.80
8.1.20.0030.01017.84
8.1.10.0040.00417.64
8.1.00.0040.00417.59
8.0.300.0040.00418.77
8.0.290.0070.00017.00
8.0.280.0040.00418.39
8.0.270.0100.00017.17
8.0.260.0060.00317.05
8.0.250.0000.00717.00
8.0.240.0000.00717.01
8.0.230.0070.00017.14
8.0.220.0000.00716.99
8.0.210.0030.00317.04
8.0.200.0040.00416.98
8.0.190.0070.00416.98
8.0.180.0040.00417.01
8.0.170.0040.00416.93
8.0.160.0040.00417.12
8.0.150.0000.00816.99
8.0.140.0030.00617.02
8.0.130.0060.00013.49
8.0.120.0000.00816.91
8.0.110.0050.00217.17
8.0.100.0070.00017.00
8.0.90.0040.00416.88
8.0.80.0170.00916.96
8.0.70.0040.00417.08
8.0.60.0050.00316.99
8.0.50.0050.00317.08
8.0.30.0100.00817.20
8.0.20.0130.00817.46
8.0.10.0030.00516.99
8.0.00.0190.00017.18
7.4.330.0050.00015.55
7.4.320.0060.00016.82
7.4.300.0070.00016.65
7.4.290.0000.00916.71
7.4.280.0050.00316.84
7.4.270.0070.00016.74
7.4.260.0030.00316.71
7.4.250.0060.00316.71
7.4.240.0040.00416.85
7.4.230.0050.00316.92
7.4.220.0070.01016.85
7.4.210.0050.01116.80
7.4.200.0000.00716.53
7.4.160.0120.00416.79
7.4.150.0110.00717.40
7.4.140.0060.01417.86
7.4.130.0030.01416.79
7.4.120.0150.00516.74
7.4.110.0150.00316.48
7.4.100.0120.00617.04
7.4.90.0110.01116.70
7.4.80.0160.01019.39
7.4.70.0080.00816.92
7.4.60.0060.01216.73
7.4.50.0120.00616.50
7.4.40.0060.00916.66
7.4.30.0100.00616.65
7.4.00.0060.01015.00
7.3.330.0080.00013.39
7.3.320.0000.00713.43
7.3.310.0040.00416.43
7.3.300.0030.00316.46
7.3.290.0030.00516.43
7.3.280.0100.00716.46
7.3.270.0070.01117.40
7.3.260.0100.00816.57
7.3.250.0110.01116.53
7.3.240.0100.00916.69
7.3.230.0130.00616.45
7.3.210.0090.00916.50
7.3.200.0030.01916.52
7.3.190.0060.01216.52
7.3.180.0070.01016.73
7.3.170.0000.01516.80
7.3.160.0040.01216.82
7.2.330.0100.01016.71
7.2.320.0070.01016.70
7.2.310.0080.00816.89
7.2.300.0140.00916.79
7.2.290.0110.00716.90
7.2.60.0150.00016.88
7.2.00.0040.01419.42
7.1.200.0000.01116.07
7.1.100.0000.01118.54
7.1.70.0080.00517.24
7.1.60.0110.01435.26
7.1.50.0180.00735.04
7.1.40.0220.00634.72
7.1.30.0150.01134.65
7.1.20.0150.01134.76
7.1.10.0050.00816.88
7.1.00.0040.00817.03
7.0.200.0040.00816.78
7.0.190.0060.00616.95
7.0.180.0050.00916.41
7.0.170.0020.01216.28
7.0.160.0060.00616.42
7.0.150.0030.00916.59
7.0.140.0040.00916.45
7.0.130.0060.00616.50
7.0.120.0090.00316.77
7.0.110.0060.00616.71
7.0.100.0070.00416.67
7.0.90.0060.00616.50
7.0.80.0000.01116.57
7.0.70.0040.00916.38
7.0.60.0030.00816.45
7.0.50.0030.00916.57
7.0.40.0080.00416.70
7.0.30.0000.01116.65
7.0.20.0030.01016.64
7.0.10.0030.01616.51
7.0.00.0080.00416.65

preferences:
37.61 ms | 401 KiB | 5 Q