3v4l.org

run code in 300+ PHP versions simultaneously
<?php function highlight($needle, $haystack, $ignore, $highlightStart, $highlightEnd) { $replacer = static function ($matches) use ($ignore, $highlightStart, $highlightEnd) { return $highlightStart . preg_replace('([^' . $ignore . ']+)', $highlightEnd . '$0' . $highlightStart, $matches[0]) . $highlightEnd; }; $needle = str_split($needle); foreach ($needle as &$l) { $l = preg_quote($l); } unset($l); $needle = implode('[^' . $ignore . ']*', $needle); return preg_replace_callback('(' . $needle . ')', $replacer, $haystack); } echo highlight('1234', '(123) 456-7890', '0-9', '<b>', '</b>');

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.0140.00716.75
8.3.60.0220.00018.43
8.3.50.0080.01117.38
8.3.40.0150.00019.00
8.3.30.0090.00619.05
8.3.20.0080.00020.38
8.3.10.0080.00020.94
8.3.00.0050.00320.87
8.2.190.0040.01116.59
8.2.180.0170.00316.75
8.2.170.0040.01122.96
8.2.160.0070.00721.14
8.2.150.0000.00824.18
8.2.140.0060.00624.66
8.2.130.0040.00419.27
8.2.120.0000.00826.35
8.2.110.0130.00322.44
8.2.100.0110.00417.91
8.2.90.0080.00017.88
8.2.80.0080.00019.05
8.2.70.0070.00717.63
8.2.60.0000.00818.03
8.2.50.0060.00318.07
8.2.40.0040.00418.22
8.2.30.0050.00218.13
8.2.20.0030.00518.26
8.2.10.0000.00818.26
8.2.00.0000.00718.15
8.1.280.0100.00725.92
8.1.270.0080.00023.99
8.1.260.0000.00826.35
8.1.250.0030.00628.09
8.1.240.0100.00020.39
8.1.230.0040.00817.95
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0040.00417.60
8.1.190.0070.00317.48
8.1.180.0080.00018.10
8.1.170.0000.00718.92
8.1.160.0000.00718.93
8.1.150.0030.00518.89
8.1.140.0040.00419.70
8.1.130.0000.00720.96
8.1.120.0040.00417.55
8.1.110.0080.00017.48
8.1.100.0060.00317.64
8.1.90.0030.00517.57
8.1.80.0060.00317.66
8.1.70.0000.00717.61
8.1.60.0000.00817.77
8.1.50.0030.00517.63
8.1.40.0080.00017.54
8.1.30.0040.00417.76
8.1.20.0090.00017.90
8.1.10.0060.00317.71
8.1.00.0000.00817.74
8.0.300.0030.00618.77
8.0.290.0030.00516.88
8.0.280.0020.00518.39
8.0.270.0030.00317.30
8.0.260.0070.00018.89
8.0.250.0030.00317.13
8.0.240.0070.00017.09
8.0.230.0050.00217.11
8.0.220.0000.00717.05
8.0.210.0030.00317.04
8.0.200.0000.00617.01
8.0.190.0040.00417.14
8.0.180.0060.00317.11
8.0.170.0000.00816.99
8.0.160.0000.00817.02
8.0.150.0050.00517.06
8.0.140.0000.00817.04
8.0.130.0070.00013.53
8.0.120.0000.00817.00
8.0.110.0000.00716.93
8.0.100.0000.00817.02
8.0.90.0040.00416.94
8.0.80.0030.01217.09
8.0.70.0050.00217.07
8.0.60.0080.00017.12
8.0.50.0000.00716.95
8.0.30.0190.00317.05
8.0.20.0150.01217.40
8.0.10.0000.00717.25
8.0.00.0100.00716.89
7.4.330.0060.00015.55
7.4.320.0030.00316.84
7.4.300.0000.00616.83
7.4.290.0070.00316.80
7.4.280.0040.00416.73
7.4.270.0000.00916.84
7.4.260.0040.00416.82
7.4.250.0000.00716.55
7.4.240.0040.00416.76
7.4.230.0030.00316.72
7.4.220.0070.01016.62
7.4.210.0070.00716.75
7.4.200.0070.00016.73
7.4.160.0100.01016.75
7.4.150.0090.00917.40
7.4.140.0080.01117.86
7.4.130.0100.00716.84
7.4.120.0120.00816.59
7.4.110.0100.00716.75
7.4.100.0070.01116.68
7.4.90.0070.01016.73
7.4.80.0030.01319.39
7.4.70.0060.01016.65
7.4.60.0170.00016.82
7.4.50.0040.01116.64
7.4.40.0000.01716.81
7.4.30.0090.00816.44
7.4.10.0000.01815.29
7.4.00.0050.01215.28
7.3.330.0030.00313.52
7.3.320.0030.00313.49
7.3.310.0050.00216.41
7.3.300.0030.00316.52
7.3.290.0040.01316.47
7.3.280.0090.00816.46
7.3.270.0040.01417.40
7.3.260.0100.01116.71
7.3.250.0090.01016.56
7.3.240.0100.00816.71
7.3.230.0090.01316.89
7.3.210.0040.01416.66
7.3.200.0110.00816.54
7.3.190.0060.01116.47
7.3.180.0060.01516.61
7.3.170.0120.00316.77
7.3.160.0080.01416.50
7.3.130.0120.00614.96
7.3.120.0120.00615.18
7.3.110.0030.00615.03
7.3.100.0070.00715.25
7.3.90.0000.01415.03
7.3.80.0050.00515.24
7.3.70.0100.00314.78
7.3.60.0040.01114.91
7.3.50.0040.01215.13
7.3.40.0090.00615.13
7.3.30.0100.00714.84
7.3.20.0060.00316.96
7.3.10.0060.00916.83
7.3.00.0060.01216.73
7.2.330.0090.01216.87
7.2.320.0080.01916.84
7.2.310.0070.01116.98
7.2.300.0100.01016.95
7.2.290.0030.01417.03
7.2.260.0070.01115.43
7.2.250.0100.00715.11
7.2.240.0030.01214.93
7.2.230.0030.01015.34
7.2.220.0060.00915.03
7.2.210.0000.01315.37
7.2.200.0070.00715.30
7.2.190.0000.01215.31
7.2.180.0070.00315.16
7.2.170.0000.01315.20
7.2.160.0000.01415.17
7.2.150.0070.01016.94
7.2.140.0030.00917.21
7.2.130.0090.01017.18
7.2.120.0030.01417.16
7.2.110.0060.00917.23
7.2.100.0090.00317.02
7.2.90.0080.01117.22
7.2.80.0070.00716.96
7.2.70.0060.00917.09
7.2.60.0090.00916.98
7.2.50.0000.01916.95
7.2.40.0060.00317.32
7.2.30.0120.00317.18
7.2.20.0060.00917.23
7.2.10.0140.00016.96
7.2.00.0100.00317.14
7.1.330.0060.00616.28
7.1.320.0090.00316.13
7.1.310.0030.00515.95
7.1.300.0040.01415.92
7.1.290.0000.01016.22
7.1.280.0070.00715.94
7.1.270.0090.00616.00
7.1.260.0090.00015.74
7.1.250.0080.00416.13
7.1.240.0000.01115.91
7.1.230.0070.00415.82
7.1.220.0030.01215.78
7.1.210.0020.01315.90
7.1.200.0040.00515.87
7.1.190.0050.00515.98
7.1.180.0040.01216.21
7.1.170.0100.00715.94
7.1.160.0030.00616.17
7.1.150.0100.00715.74
7.1.140.0080.00416.14
7.1.130.0050.00315.78
7.1.120.0030.01015.86
7.1.110.0000.01716.13
7.1.100.0000.01315.95
7.1.90.0040.00816.11
7.1.80.0720.01016.09
7.1.70.0610.00815.75
7.1.60.0810.00824.88
7.1.50.0730.00724.46
7.1.40.0740.01024.29
7.1.30.0850.01124.35
7.1.20.0800.00824.59
7.1.10.0690.00915.27
7.1.00.0540.00715.69
7.0.330.0140.00315.35
7.0.320.0060.00915.48
7.0.310.0060.00615.52
7.0.300.0040.01115.59
7.0.290.0060.00915.61
7.0.280.0060.00615.64
7.0.270.0040.00415.69
7.0.260.0040.01115.52
7.0.250.0000.01015.70
7.0.240.0000.00915.52
7.0.230.0030.00615.60
7.0.220.0000.01415.52
7.0.210.0000.01615.66
7.0.200.0720.00515.54
7.0.190.0640.00615.43
7.0.180.0670.00715.03
7.0.170.0700.00915.17
7.0.160.1700.00615.07
7.0.150.0650.00514.98
7.0.140.0560.00714.98
7.0.130.0540.00915.38
7.0.120.0510.00915.26
7.0.110.0610.00815.16
7.0.100.0570.01115.28
7.0.90.0550.01115.11
7.0.80.0660.01215.25
7.0.70.0660.00915.15
7.0.60.0520.01415.17
7.0.50.0510.01115.21
7.0.40.0540.00814.41
7.0.30.0500.00914.35
7.0.20.0560.01314.14
7.0.10.0550.01114.26
7.0.00.0490.00714.40
5.6.400.0070.00714.70
5.6.390.0060.01214.41
5.6.380.0140.00014.37
5.6.370.0030.00714.25
5.6.360.0040.01414.46
5.6.350.0030.00514.67
5.6.340.0060.00914.59
5.6.330.0040.00814.46
5.6.320.0000.01214.28
5.6.310.0030.01214.76
5.6.300.0130.00014.37
5.6.290.0030.01014.75
5.6.280.0100.00314.45
5.6.270.0070.01014.31
5.6.260.0000.00914.55
5.6.250.0070.00714.41
5.6.240.0000.01414.46
5.6.230.0030.00914.77
5.6.220.0000.01114.46
5.6.210.0080.00814.44
5.6.200.0030.01014.48
5.6.190.0080.00314.60
5.6.180.0100.00314.56
5.6.170.0060.00614.29
5.6.160.0050.00514.55
5.6.150.0090.00614.34
5.6.140.0120.00314.96
5.6.130.0120.00614.80
5.6.120.0090.00614.53
5.6.110.0090.00314.36
5.6.100.0060.00614.58
5.6.90.0030.00614.80
5.6.80.0060.00914.76
5.6.70.0030.00714.21
5.6.60.0060.00914.50
5.6.50.0060.00914.49
5.6.40.0040.00814.27
5.6.30.0000.01014.50
5.6.20.0070.00714.66
5.6.10.0070.00714.15
5.6.00.0030.00614.53

preferences:
53.52 ms | 401 KiB | 5 Q