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.0000.01417.00
8.3.50.0000.01416.53
8.3.40.0080.00818.89
8.3.30.0100.00718.82
8.3.20.0040.00420.14
8.3.10.0050.00323.65
8.3.00.0090.00019.63
8.2.180.0140.00716.88
8.2.170.0060.00922.96
8.2.160.0070.01020.39
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00420.97
8.2.120.0050.00326.35
8.2.110.0060.00319.36
8.2.100.0110.00018.28
8.2.90.0000.00819.21
8.2.80.0050.00317.97
8.2.70.0060.00317.62
8.2.60.0040.00417.93
8.2.50.0030.00618.10
8.2.40.0000.00820.47
8.2.30.0040.00421.17
8.2.20.0000.00718.05
8.2.10.0040.00418.04
8.2.00.0000.00718.23
8.1.280.0090.00625.92
8.1.270.0040.00422.02
8.1.260.0070.00026.35
8.1.250.0020.00528.09
8.1.240.0000.00923.83
8.1.230.0090.00617.52
8.1.220.0030.00517.76
8.1.210.0030.00618.77
8.1.200.0030.00617.36
8.1.190.0000.00817.48
8.1.180.0030.00518.10
8.1.170.0070.00318.67
8.1.160.0000.00718.98
8.1.150.0050.00220.58
8.1.140.0040.00419.62
8.1.130.0030.00618.93
8.1.120.0070.00017.66
8.1.110.0000.00817.64
8.1.100.0040.00417.60
8.1.90.0040.00417.60
8.1.80.0040.00417.52
8.1.70.0030.00317.68
8.1.60.0030.00617.66
8.1.50.0040.00417.65
8.1.40.0030.00517.72
8.1.30.0040.00417.74
8.1.20.0110.00017.73
8.1.10.0040.00417.75
8.1.00.0040.00417.57
8.0.300.0000.00818.77
8.0.290.0030.00516.75
8.0.280.0030.00318.49
8.0.270.0000.00717.23
8.0.260.0030.00316.92
8.0.250.0000.00717.04
8.0.240.0050.00216.98
8.0.230.0030.00317.05
8.0.220.0000.00716.95
8.0.210.0070.00017.13
8.0.200.0040.00416.99
8.0.190.0070.00417.11
8.0.180.0000.00716.98
8.0.170.0040.00416.99
8.0.160.0050.00217.04
8.0.150.0030.00517.02
8.0.140.0000.01116.98
8.0.130.0030.00313.55
8.0.120.0040.00417.01
8.0.110.0040.00417.08
8.0.100.0050.00216.93
8.0.90.0030.00517.07
8.0.80.0120.01117.08
8.0.70.0000.00917.06
8.0.60.0000.00816.93
8.0.50.0070.00016.96
8.0.30.0090.01017.39
8.0.20.0110.00917.40
8.0.10.0040.00417.01
8.0.00.0140.00316.82
7.4.330.0000.00515.55
7.4.320.0000.00616.88
7.4.300.0030.00316.82
7.4.290.0030.00716.81
7.4.280.0060.00316.84
7.4.270.0040.00416.80
7.4.260.0080.00013.45
7.4.250.0050.00316.71
7.4.240.0000.00716.74
7.4.230.0030.00516.93
7.4.220.0070.01116.79
7.4.210.0130.00816.66
7.4.200.0040.00416.64
7.4.160.0070.01316.71
7.4.150.0060.01217.40
7.4.140.0130.00617.86
7.4.130.0090.00916.52
7.4.120.0130.00716.86
7.4.110.0090.01216.81
7.4.100.0100.00716.71
7.4.90.0070.01016.73
7.4.80.0180.00019.39
7.4.70.0070.01016.91
7.4.60.0130.00316.79
7.4.50.0110.00616.63
7.4.40.0090.00616.85
7.4.30.0070.01116.84
7.4.00.0120.00014.93
7.3.330.0080.00013.46
7.3.320.0030.00313.44
7.3.310.0070.00016.52
7.3.300.0030.00316.31
7.3.290.0070.00016.52
7.3.280.0080.00916.45
7.3.270.0110.00517.40
7.3.260.0090.00716.79
7.3.250.0120.00516.71
7.3.240.0070.01316.60
7.3.230.0090.00916.95
7.3.210.0130.00316.53
7.3.200.0070.01016.67
7.3.190.0000.01816.52
7.3.180.0070.01016.76
7.3.170.0120.00316.55
7.3.160.0060.01216.41
7.2.330.0140.00716.63
7.2.320.0060.01216.79
7.2.310.0070.01016.93
7.2.300.0090.00916.75
7.2.290.0080.01116.97
7.2.60.0110.00317.20
7.2.00.0060.00619.83
7.1.200.0060.01015.76
7.1.100.0000.01318.52
7.1.70.0000.01217.31
7.1.60.0160.01035.40
7.1.50.0120.01534.88
7.1.40.0230.00534.79
7.1.30.0150.01234.74
7.1.20.0100.01634.88
7.1.10.0030.01216.96
7.1.00.0080.00416.97
7.0.200.0080.00417.02
7.0.190.0030.01016.91
7.0.180.0100.00316.56
7.0.170.0060.00816.33
7.0.160.0060.00616.33
7.0.150.0070.00716.37
7.0.140.0130.00016.73
7.0.130.0060.00616.69
7.0.120.0000.01316.51
7.0.110.0030.00916.63
7.0.100.0030.00916.77
7.0.90.0000.01216.68
7.0.80.0070.00716.55
7.0.70.0100.00716.61
7.0.60.0040.00816.14
7.0.50.0060.00616.61
7.0.40.0000.01316.59
7.0.30.0100.00216.50
7.0.20.0030.00916.68
7.0.10.0000.01216.56
7.0.00.0030.01216.52

preferences:
45.42 ms | 401 KiB | 5 Q