3v4l.org

run code in 300+ PHP versions simultaneously
<?php function highlight($text, $words) { preg_match_all ( '~[a-zA-Z_\']+~', $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.70.0110.01118.43
8.3.60.0040.01516.63
8.3.50.0230.00516.43
8.3.40.0150.00019.06
8.3.30.0090.00618.84
8.3.20.0080.00022.14
8.3.10.0040.00423.68
8.3.00.0030.00619.51
8.2.190.0120.00618.79
8.2.180.0140.00418.66
8.2.170.0070.00722.96
8.2.160.0100.00320.33
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0030.00521.07
8.2.120.0040.00426.35
8.2.110.0030.00720.98
8.2.100.0000.01117.91
8.2.90.0050.00518.34
8.2.80.0040.00417.97
8.2.70.0040.00417.75
8.2.60.0040.00417.93
8.2.50.0080.00018.10
8.2.40.0040.00420.47
8.2.30.0050.00321.01
8.2.20.0040.00418.22
8.2.10.0040.00418.20
8.2.00.0080.00018.21
8.1.280.0110.00425.92
8.1.270.0030.00623.84
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0030.00720.77
8.1.230.0080.00320.89
8.1.220.0050.00317.74
8.1.210.0050.00318.83
8.1.200.0000.01017.35
8.1.190.0000.00917.35
8.1.180.0040.00418.10
8.1.170.0080.00418.63
8.1.160.0040.00419.04
8.1.150.0060.00320.71
8.1.140.0080.00019.48
8.1.130.0040.00418.88
8.1.120.0000.00717.63
8.1.110.0000.00717.65
8.1.100.0000.00717.61
8.1.90.0040.00717.69
8.1.80.0000.00717.62
8.1.70.0040.00417.59
8.1.60.0050.00317.71
8.1.50.0000.00817.71
8.1.40.0000.00817.74
8.1.30.0000.00817.86
8.1.20.0060.00317.77
8.1.10.0040.00417.75
8.1.00.0000.00917.58
8.0.300.0040.00420.23
8.0.290.0040.00416.75
8.0.280.0000.00718.47
8.0.270.0000.00717.16
8.0.260.0000.00716.99
8.0.250.0050.00317.11
8.0.240.0040.00417.04
8.0.230.0000.00717.12
8.0.220.0000.00716.98
8.0.210.0030.00317.03
8.0.200.0070.00017.10
8.0.190.0100.00017.14
8.0.180.0040.00417.10
8.0.170.0070.00016.97
8.0.160.0070.00016.93
8.0.150.0000.00717.02
8.0.140.0070.00317.00
8.0.130.0030.00313.56
8.0.120.0030.00516.89
8.0.110.0050.00217.06
8.0.100.0040.00416.87
8.0.90.0040.00416.96
8.0.80.0070.01017.05
8.0.70.0070.00016.86
8.0.60.0020.00516.91
8.0.50.0040.00416.91
8.0.30.0080.00817.16
8.0.20.0090.01217.42
8.0.10.0020.00517.19
8.0.00.0120.00616.80
7.4.330.0050.00015.55
7.4.320.0000.00616.73
7.4.300.0040.00416.72
7.4.290.0030.00716.63
7.4.280.0000.00916.79
7.4.270.0070.00016.81
7.4.260.0000.00813.41
7.4.250.0000.00816.73
7.4.240.0000.00816.69
7.4.230.0050.00316.80
7.4.220.0060.00916.77
7.4.210.0060.00916.84
7.4.200.0040.00416.52
7.4.160.0080.00816.77
7.4.150.0070.01017.40
7.4.140.0120.00817.86
7.4.130.0060.01416.67
7.4.120.0080.00916.65
7.4.110.0150.00416.76
7.4.100.0160.00016.72
7.4.90.0060.01216.89
7.4.80.0200.00319.39
7.4.70.0120.00416.73
7.4.60.0120.00916.79
7.4.50.0030.01316.69
7.4.40.0030.01216.38
7.4.30.0090.00916.68
7.4.00.0100.00714.98
7.3.330.0030.00613.45
7.3.320.0050.00013.40
7.3.310.0000.00716.32
7.3.300.0000.00716.31
7.3.290.0060.01016.44
7.3.280.0070.01016.46
7.3.270.0040.01317.40
7.3.260.0110.00816.57
7.3.250.0130.00616.72
7.3.240.0110.00816.55
7.3.230.0000.02216.51
7.3.210.0100.00916.48
7.3.200.0150.01016.49
7.3.190.0080.00816.30
7.3.180.0070.01016.52
7.3.170.0060.01016.88
7.3.160.0120.00616.57
7.3.120.0100.00714.88
7.3.110.0030.01414.84
7.3.100.0070.00714.72
7.3.90.0070.00714.61
7.3.80.0000.01414.93
7.3.70.0040.01115.03
7.3.60.0030.00914.68
7.3.50.0070.00415.00
7.3.40.0070.00715.04
7.3.30.0060.00614.98
7.3.20.0030.00616.70
7.3.10.0070.00716.71
7.3.00.0080.00516.80
7.2.330.0070.01416.88
7.2.320.0060.00916.81
7.2.310.0040.01216.64
7.2.300.0000.01816.71
7.2.290.0100.00716.64
7.2.250.0090.00615.40
7.2.240.0040.01215.28
7.2.230.0030.01315.32
7.2.220.0040.01415.39
7.2.210.0080.00414.96
7.2.200.0040.00715.06
7.2.190.0040.01115.17
7.2.180.0030.01015.19
7.2.170.0100.00014.98
7.2.160.0040.01115.10
7.2.150.0000.01217.28
7.2.140.0060.01017.16
7.2.130.0040.01117.12
7.2.120.0080.00817.16
7.2.110.0040.01117.18
7.2.100.0000.01317.11
7.2.90.0000.01517.20
7.2.80.0030.01317.14
7.2.70.0030.01017.13
7.2.60.0030.00817.13
7.2.50.0060.00316.97
7.2.40.0090.00617.19
7.2.30.0070.00717.16
7.2.20.0000.01317.10
7.2.10.0030.00916.80
7.2.00.0070.00716.80
7.1.330.0090.00615.85
7.1.320.0100.00715.79
7.1.310.0070.00415.77
7.1.300.0060.00315.98
7.1.290.0080.00415.88
7.1.280.0050.00815.79
7.1.270.0100.00015.72
7.1.260.0030.01016.11
7.1.250.0030.01015.73
7.1.200.0060.00615.94
7.1.70.0000.00717.42
7.1.60.0060.01617.46
7.1.50.0070.00416.98
7.1.40.0040.00716.86
7.1.30.0110.00416.73
7.1.20.0070.00416.85
7.1.10.0030.00516.96
7.1.00.0000.00817.10
7.0.200.0000.00717.02
7.0.190.0030.00517.00
7.0.180.0000.00716.33
7.0.170.0070.00016.35
7.0.160.0040.00416.46
7.0.150.0000.00716.48
7.0.140.0070.00316.32
7.0.130.0000.00716.56
7.0.120.0040.00416.84
7.0.110.0040.00416.56
7.0.100.0030.00516.58
7.0.90.0040.00716.42
7.0.80.0030.00616.75
7.0.70.0040.00416.38
7.0.60.0000.00816.46
7.0.50.0040.00416.61
7.0.40.0030.00514.92
7.0.30.0040.00414.92
7.0.20.0030.00614.92
7.0.10.0000.00714.92
7.0.00.0000.00814.92

preferences:
21.08 ms | 401 KiB | 5 Q