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.0120.00618.56
8.3.60.0160.00616.75
8.3.50.0130.00516.61
8.3.40.0140.00718.67
8.3.30.0110.00418.50
8.3.20.0080.00020.31
8.3.10.0070.00021.77
8.3.00.0090.00019.33
8.2.180.0090.00918.54
8.2.170.0070.00722.96
8.2.160.0110.00320.43
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00420.80
8.2.120.0000.00826.35
8.2.110.0000.00919.23
8.2.100.0030.00718.09
8.2.90.0040.00419.05
8.2.80.0030.00617.97
8.2.70.0060.00317.75
8.2.60.0000.00717.80
8.2.50.0080.00018.10
8.2.40.0040.00420.42
8.2.30.0000.00821.11
8.2.20.0020.00517.98
8.2.10.0000.00718.05
8.2.00.0040.00417.98
8.1.280.0070.01125.92
8.1.270.0040.00422.14
8.1.260.0000.00826.35
8.1.250.0050.00228.09
8.1.240.0040.00423.88
8.1.230.0030.01017.52
8.1.220.0000.00817.74
8.1.210.0100.00018.77
8.1.200.0060.00317.35
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0000.01018.68
8.1.160.0000.00818.92
8.1.150.0070.00318.87
8.1.140.0040.00419.57
8.1.130.0030.00318.92
8.1.120.0040.00417.50
8.1.110.0040.00417.42
8.1.100.0000.00917.50
8.1.90.0000.01017.34
8.1.80.0070.00017.47
8.1.70.0030.00517.40
8.1.60.0030.00617.57
8.1.50.0000.00817.53
8.1.40.0000.00817.51
8.1.30.0040.00417.53
8.1.20.0050.00517.64
8.1.10.0040.00417.46
8.1.00.0040.00417.34
8.0.300.0080.00018.77
8.0.290.0050.00316.63
8.0.280.0030.00318.44
8.0.270.0030.00617.17
8.0.260.0030.00516.89
8.0.250.0000.00716.99
8.0.240.0030.00616.96
8.0.230.0030.00317.01
8.0.220.0030.00316.83
8.0.210.0070.00016.95
8.0.200.0000.00716.93
8.0.190.0110.00016.85
8.0.180.0050.00316.96
8.0.170.0040.00416.86
8.0.160.0000.00716.89
8.0.150.0000.00816.80
8.0.140.0080.00416.94
8.0.130.0060.00013.38
8.0.120.0000.00816.95
8.0.110.0000.00717.02
8.0.100.0040.00416.84
8.0.90.0040.00416.97
8.0.80.0110.00416.93
8.0.70.0040.00416.76
8.0.60.0000.00717.04
8.0.50.0000.00716.83
8.0.30.0100.00817.16
8.0.20.0100.01217.40
8.0.10.0080.00017.05
8.0.00.0040.01416.55
7.4.330.0050.00015.55
7.4.320.0000.00616.46
7.4.300.0060.00016.50
7.4.290.0050.00316.45
7.4.280.0040.00416.51
7.4.270.0000.00716.63
7.4.260.0000.00513.30
7.4.250.0000.00716.56
7.4.240.0050.00316.52
7.4.230.0000.00716.39
7.4.220.0100.00716.64
7.4.210.0080.00816.50
7.4.200.0030.00316.70
7.4.160.0060.01016.51
7.4.150.0110.00817.40
7.4.140.0110.00717.86
7.4.130.0120.00916.71
7.4.120.0080.00916.56
7.4.110.0060.01516.60
7.4.100.0000.01616.36
7.4.90.0100.00716.54
7.4.80.0040.01319.39
7.4.70.0080.00916.55
7.4.60.0090.00616.61
7.4.50.0050.00716.50
7.4.40.0070.01016.31
7.4.30.0080.00816.48
7.4.10.0170.00314.86
7.4.00.0090.00815.07
7.3.330.0030.00313.44
7.3.320.0030.00313.29
7.3.310.0000.00816.39
7.3.300.0000.00716.21
7.3.290.0060.00716.32
7.3.280.0090.00716.34
7.3.270.0150.00417.40
7.3.260.0060.01116.35
7.3.250.0140.00316.32
7.3.240.0090.00816.58
7.3.230.0150.00316.41
7.3.210.0000.01816.26
7.3.200.0030.02016.26
7.3.190.0100.00716.40
7.3.180.0080.00816.48
7.3.170.0060.01016.67
7.3.160.0100.00716.52
7.3.130.0090.00915.01
7.3.120.0070.01015.03
7.3.110.0120.00614.57
7.3.100.0030.00814.72
7.3.90.0100.00314.77
7.3.80.0040.00814.87
7.3.70.0120.00014.56
7.3.60.0050.00314.98
7.3.50.0120.00014.99
7.3.40.0040.00715.00
7.3.30.0030.01014.69
7.3.20.0130.00016.80
7.3.10.0040.00816.77
7.3.00.0110.00016.56
7.2.330.0090.00916.80
7.2.320.0090.00916.65
7.2.310.0130.01016.70
7.2.300.0110.01216.28
7.2.290.0110.00816.64
7.2.260.0110.00714.92
7.2.250.0060.01314.94
7.2.240.0090.00615.21
7.2.230.0070.00715.21
7.2.220.0090.00615.17
7.2.210.0030.00714.95
7.2.200.0030.00915.13
7.2.190.0030.01014.78
7.2.180.0030.01015.07
7.2.170.0040.00715.16
7.2.160.0000.01015.00
7.2.150.0070.01016.57
7.2.140.0030.01016.85
7.2.130.0050.00516.88
7.2.120.0100.00716.87
7.2.110.0150.00416.65
7.2.100.0000.01316.79
7.2.90.0090.00316.90
7.2.80.0070.00316.73
7.2.70.0060.00916.81
7.2.60.0080.00316.78
7.2.50.0090.00616.95
7.2.40.0080.00817.02
7.2.30.0060.00316.75
7.2.20.0090.00616.96
7.2.10.0070.01016.69
7.2.00.0030.01017.90
7.1.330.0040.01115.61
7.1.320.0040.00415.83
7.1.310.0060.00615.80
7.1.300.0040.00815.64
7.1.290.0030.00615.82
7.1.280.0030.01015.59
7.1.270.0100.00715.76
7.1.260.0030.01015.62
7.1.250.0100.00315.83
7.1.240.0040.01215.75
7.1.230.0000.01015.52
7.1.220.0030.00915.85
7.1.210.0040.00415.73
7.1.200.0050.00715.86
7.1.190.0060.00315.78
7.1.180.0030.00715.88
7.1.170.0140.00015.76
7.1.160.0070.00715.88
7.1.150.0040.01115.85
7.1.140.0110.00315.76
7.1.130.0070.00415.43
7.1.120.0150.00015.77
7.1.110.0070.01015.61
7.1.100.0080.00716.96
7.1.90.0000.01115.87
7.1.80.0060.00915.77
7.1.70.0070.00516.43
7.1.60.0100.01025.39
7.1.50.0090.00725.15
7.1.40.0100.00925.10
7.1.30.0140.00724.94
7.1.20.0080.01225.10
7.1.10.0070.00516.13
7.1.00.0050.00716.17
7.0.330.0000.01415.42
7.0.320.0040.00415.11
7.0.310.0070.00715.23
7.0.300.0080.00315.34
7.0.290.0030.00915.25
7.0.280.0060.00915.14
7.0.270.0000.01115.29
7.0.260.0080.00015.54
7.0.250.0030.00515.13
7.0.240.0100.00315.28
7.0.230.0030.01415.49
7.0.220.0040.01014.96
7.0.210.0100.00315.30
7.0.200.0050.00415.96
7.0.190.0050.00915.91
7.0.180.0090.00415.79
7.0.170.0070.00515.70
7.0.160.0070.00515.62
7.0.150.0070.00715.70
7.0.140.0050.00815.68
7.0.130.0060.00815.81
7.0.120.0070.00615.81
7.0.110.0090.00215.88
7.0.100.0070.00415.79
7.0.90.0030.00915.86
7.0.80.0030.01016.00
7.0.70.0070.00715.89
7.0.60.0070.00515.80
7.0.50.0060.00615.88
7.0.40.0030.00714.76
7.0.30.0050.00714.91
7.0.20.0070.00414.79
7.0.10.0000.01115.04
7.0.00.0060.00415.04
5.6.400.0090.00614.38
5.6.390.0120.00314.34
5.6.380.0030.00514.39
5.6.370.0110.00414.32
5.6.360.0070.00714.29
5.6.350.0070.00414.34
5.6.340.0030.00813.94
5.6.330.0000.01414.40
5.6.320.0100.00314.40
5.6.310.0070.01114.39
5.6.300.0050.00514.27
5.6.290.0070.00714.58
5.6.280.0040.00914.11
5.6.270.0040.01214.42
5.6.260.0080.00814.15
5.6.250.0000.00914.62
5.6.240.0060.00614.28
5.6.230.0070.00714.46
5.6.220.0000.00814.14
5.6.210.0030.01014.21
5.6.200.0070.00714.40
5.6.190.0120.00314.25
5.6.180.0040.00414.32
5.6.170.0090.00614.22
5.6.160.0060.00614.34
5.6.150.0090.00614.42
5.6.140.0120.00314.46
5.6.130.0030.01014.40
5.6.120.0090.00014.32
5.6.110.0090.00314.26
5.6.100.0040.01114.25
5.6.90.0070.00714.23
5.6.80.0070.00714.20
5.6.70.0100.00313.95
5.6.60.0100.00314.23
5.6.50.0090.00314.54
5.6.40.0120.00314.20
5.6.30.0040.01114.16
5.6.20.0060.00914.02
5.6.10.0000.01414.52
5.6.00.0030.01014.36

preferences:
49.22 ms | 401 KiB | 5 Q