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);

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.0060.00916.88
8.3.50.0040.01116.77
8.3.40.0140.00319.00
8.3.30.0120.00318.86
8.3.20.0040.00420.29
8.3.10.0050.00323.66
8.3.00.0090.00019.50
8.2.180.0070.00716.38
8.2.170.0060.00922.96
8.2.160.0100.01020.61
8.2.150.0090.00024.18
8.2.140.0060.00324.66
8.2.130.0050.00321.12
8.2.120.0040.00426.35
8.2.110.0060.00320.21
8.2.100.0110.00018.22
8.2.90.0000.00819.20
8.2.80.0040.00418.04
8.2.70.0030.00617.75
8.2.60.0050.00317.93
8.2.50.0050.00318.10
8.2.40.0070.00020.61
8.2.30.0060.00321.01
8.2.20.0080.00018.28
8.2.10.0030.00518.03
8.2.00.0040.00418.10
8.1.280.0090.00925.92
8.1.270.0000.00722.08
8.1.260.0050.00226.35
8.1.250.0030.00528.09
8.1.240.0030.00620.72
8.1.230.0120.00317.51
8.1.220.0080.00017.74
8.1.210.0000.00818.77
8.1.200.0030.00717.47
8.1.190.0040.00417.35
8.1.180.0040.00418.10
8.1.170.0000.00818.73
8.1.160.0000.00718.95
8.1.150.0040.00420.75
8.1.140.0080.00019.61
8.1.130.0040.00418.92
8.1.120.0000.00717.65
8.1.110.0040.00417.54
8.1.100.0000.00717.52
8.1.90.0030.00717.63
8.1.80.0000.00717.63
8.1.70.0080.00017.62
8.1.60.0000.00817.64
8.1.50.0080.00017.69
8.1.40.0060.00317.64
8.1.30.0000.00817.83
8.1.20.0080.00417.82
8.1.10.0040.00417.71
8.1.00.0050.00317.64
8.0.300.0030.00618.77
8.0.290.0070.00016.88
8.0.280.0030.00318.46
8.0.270.0000.00717.22
8.0.260.0040.00417.05
8.0.250.0070.00017.05
8.0.240.0000.00717.18
8.0.230.0040.00417.00
8.0.220.0000.00717.01
8.0.210.0000.00817.12
8.0.200.0030.00617.04
8.0.190.0070.00717.19
8.0.180.0040.00417.16
8.0.170.0040.00417.10
8.0.160.0000.00717.10
8.0.150.0000.00817.04
8.0.140.0000.00917.08
8.0.130.0000.00613.58
8.0.120.0000.00817.11
8.0.110.0040.00416.97
8.0.100.0040.00417.15
8.0.90.0000.00817.00
8.0.80.0120.00416.99
8.0.70.0040.00417.05
8.0.60.0030.00517.20
8.0.50.0000.00717.09
8.0.30.0090.01117.43
8.0.20.0110.00817.46
8.0.10.0020.00517.14
8.0.00.0090.00917.18
7.4.330.0000.00515.55
7.4.320.0000.00716.63
7.4.300.0030.00316.82
7.4.290.0070.00416.63
7.4.280.0030.00616.77
7.4.270.0050.00216.71
7.4.260.0040.00416.80
7.4.250.0000.00716.61
7.4.240.0020.00516.83
7.4.230.0060.00316.83
7.4.220.0120.00916.71
7.4.210.0060.00816.81
7.4.200.0030.00316.75
7.4.160.0110.00516.55
7.4.150.0120.01917.40
7.4.140.0110.00817.86
7.4.130.0200.00316.54
7.4.120.0120.00616.64
7.4.110.0130.00616.86
7.4.100.0030.01516.70
7.4.90.0100.01016.45
7.4.80.0060.01019.39
7.4.70.0080.00816.77
7.4.60.0100.00616.62
7.4.50.0030.01216.73
7.4.40.0130.00316.60
7.4.30.0000.01616.77
7.4.00.0060.01015.14
7.3.330.0030.00313.37
7.3.320.0030.00313.51
7.3.310.0030.00316.39
7.3.300.0060.00016.47
7.3.290.0070.00016.53
7.3.280.0090.00716.51
7.3.270.0110.00517.40
7.3.260.0050.01216.71
7.3.250.0130.00716.59
7.3.240.0110.00616.71
7.3.230.0150.00316.66
7.3.210.0150.00416.69
7.3.200.0090.00916.43
7.3.190.0120.00616.61
7.3.180.0080.00816.46
7.3.170.0040.01216.52
7.3.160.0120.00616.54
7.3.120.0090.00614.91
7.3.110.0070.01314.97
7.3.100.0030.01114.86
7.3.90.0090.00914.79
7.3.80.0020.01314.89
7.3.70.0020.01015.03
7.3.60.0020.01414.97
7.3.50.0080.00515.10
7.3.40.0070.00514.98
7.3.30.0020.00814.96
7.3.20.0070.00616.77
7.3.10.0050.00716.71
7.3.00.0120.00216.92
7.2.330.0070.01416.86
7.2.320.0070.01016.94
7.2.310.0040.01316.88
7.2.300.0000.01716.62
7.2.290.0050.01416.91
7.2.250.0070.01215.15
7.2.240.0070.01215.28
7.2.230.0060.00715.44
7.2.220.0050.00715.03
7.2.210.0040.00915.10
7.2.200.0050.01215.31
7.2.190.0070.00615.18
7.2.180.0030.00815.29
7.2.170.0080.00515.04
7.2.60.0030.01317.12
7.1.330.0080.00816.04
7.1.320.0030.01116.09
7.1.310.0090.00615.91
7.1.300.0040.00816.00
7.1.290.0100.00315.88
7.1.280.0030.01216.01
7.1.270.0060.00816.05
7.1.260.0070.00516.03
7.1.200.0030.00715.75
7.1.70.0030.00917.26
7.1.60.0140.01035.35
7.1.50.0190.00634.99
7.1.40.0160.01034.94
7.1.30.0120.01534.68
7.1.20.0220.00834.89
7.1.10.0100.00316.94
7.1.00.0060.00616.89
7.0.200.0040.00816.88
7.0.190.0040.00816.78
7.0.180.0090.00216.24
7.0.170.0070.00716.39
7.0.160.0120.00416.45
7.0.150.0000.01316.29
7.0.140.0040.00816.58
7.0.130.0030.01016.59
7.0.120.0100.00616.60
7.0.110.0060.00616.41
7.0.100.0070.00416.64
7.0.90.0060.00616.38
7.0.80.0030.00916.52
7.0.70.0060.00616.57
7.0.60.0070.00416.15
7.0.50.0060.00616.44
7.0.40.0060.00616.61
7.0.30.0000.01116.59
7.0.20.0000.01216.69
7.0.10.0100.00316.57
7.0.00.0000.01216.60

preferences:
37.56 ms | 400 KiB | 5 Q