3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '<a href="hello">world</a><div>wow <div>such depth</div> with another <a href="foo">link</a></div> <h1>and other html stuff</h1>'; $id = 1; print $str; print "\n"; $new_str = preg_replace_callback("/(<a|<div)/", function($match) use (&$id) { switch ($match[1]) { case '<div': $result = '<div id="b_'.$id.'"'; break; case '<a': $result = '<!-- UNIT'.$id.' --><a id="a_'.$id.'"'; break; default: $result = ""; break; } $id++; return $result; }, $str); print $new_str;

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.0130.00318.56
8.3.50.0140.00822.11
8.3.40.0090.00619.09
8.3.30.0030.01020.30
8.3.20.0000.00820.18
8.3.10.0110.00722.14
8.3.00.0070.00022.51
8.2.180.0140.00716.75
8.2.170.0110.00722.96
8.2.160.0140.00722.13
8.2.150.0060.00324.18
8.2.140.0050.00524.66
8.2.130.0070.00726.16
8.2.120.0080.00019.78
8.2.110.0090.00020.46
8.2.100.0120.00017.84
8.2.90.0050.00319.36
8.2.80.0000.00719.34
8.2.70.0060.00317.88
8.2.60.0030.00517.93
8.2.50.0040.00418.07
8.2.40.0040.00418.16
8.2.30.0000.00718.06
8.2.20.0040.00417.99
8.2.10.0030.00517.79
8.2.00.0090.00317.78
8.1.280.0080.01125.92
8.1.270.0000.00824.66
8.1.260.0050.00226.35
8.1.250.0060.00328.09
8.1.240.0040.00722.20
8.1.230.0090.00319.10
8.1.220.0080.00017.74
8.1.210.0000.00918.77
8.1.200.0070.00317.48
8.1.190.0040.00417.52
8.1.180.0060.00319.26
8.1.170.0000.00818.51
8.1.160.0000.00822.17
8.1.150.0020.00518.81
8.1.140.0040.00417.58
8.1.130.0000.00717.87
8.1.120.0000.00717.59
8.1.110.0000.00817.64
8.1.100.0040.00417.67
8.1.90.0000.00717.54
8.1.80.0000.00817.55
8.1.70.0040.00417.64
8.1.60.0000.00817.65
8.1.50.0000.00817.74
8.1.40.0020.00517.66
8.1.30.0080.00017.81
8.1.20.0000.00817.71
8.1.10.0040.00417.60
8.1.00.0040.00417.56
8.0.300.0000.00718.77
8.0.290.0040.00417.04
8.0.280.0040.00418.46
8.0.270.0000.00717.20
8.0.260.0060.00017.02
8.0.250.0030.00317.18
8.0.240.0080.00017.10
8.0.230.0020.00517.10
8.0.220.0000.00717.02
8.0.210.0030.00317.03
8.0.200.0000.00617.12
8.0.190.0040.00417.08
8.0.180.0070.00016.95
8.0.170.0040.00417.09
8.0.160.0030.00616.92
8.0.150.0000.00816.87
8.0.140.0040.00417.00
8.0.130.0030.00313.40
8.0.120.0000.00817.10
8.0.110.0000.00716.99
8.0.100.0040.00416.92
8.0.90.0030.00316.87
8.0.80.0030.01617.09
8.0.70.0070.00017.11
8.0.60.0080.00016.89
8.0.50.0050.00217.15
8.0.30.0100.01017.22
8.0.20.0110.00817.40
8.0.10.0040.00417.13
8.0.00.0110.01416.96
7.4.330.0030.00315.00
7.4.320.0070.00016.80
7.4.300.0000.00616.74
7.4.290.0030.00316.82
7.4.280.0000.00816.70
7.4.270.0030.00316.73
7.4.260.0000.00716.72
7.4.250.0000.00816.70
7.4.240.0040.00416.75
7.4.230.0030.00316.84
7.4.220.0120.00916.93
7.4.210.0090.00716.73
7.4.200.0030.00516.87
7.4.190.0070.00016.97
7.4.160.0070.01416.52
7.4.150.0100.00717.40
7.4.140.0120.00717.86
7.4.130.0110.00616.66
7.4.120.0130.00416.80
7.4.110.0070.01116.70
7.4.100.0160.00916.64
7.4.90.0140.00716.54
7.4.80.0100.01119.39
7.4.70.0060.01016.71
7.4.60.0070.01416.54
7.4.50.0000.00816.77
7.4.40.0090.00622.77
7.4.30.0120.00616.69
7.4.00.0100.00315.15
7.3.330.0060.00013.52
7.3.320.0060.00013.27
7.3.310.0030.00316.52
7.3.300.0030.00316.37
7.3.290.0080.00916.42
7.3.280.0050.01216.48
7.3.270.0060.01317.40
7.3.260.0120.00916.93
7.3.250.0050.01516.71
7.3.240.0100.01316.46
7.3.230.0070.01116.71
7.3.210.0100.00716.45
7.3.200.0070.01419.39
7.3.190.0030.02116.58
7.3.180.0060.01016.75
7.3.170.0030.01316.57
7.3.160.0120.00416.82
7.3.120.0100.00715.24
7.3.10.0100.00316.90
7.3.00.0090.00317.01
7.2.330.0090.01016.89
7.2.320.0090.01416.78
7.2.310.0100.00616.76
7.2.300.0110.00516.68
7.2.290.0120.00616.92
7.2.130.0090.00617.15
7.2.120.0070.00717.23
7.2.110.0100.00317.34
7.2.100.0070.01017.12
7.2.90.0060.00917.25
7.2.80.0060.00916.95
7.2.70.0030.00717.36
7.2.60.0030.00917.26
7.2.50.0070.00617.17
7.2.40.0060.01017.21
7.2.30.0040.01117.14
7.2.20.0030.01217.12
7.2.10.0060.00617.30
7.2.00.0000.01017.20
7.1.250.0060.00616.16
7.1.200.0030.01016.14
7.1.70.0050.00317.26
7.1.60.0040.01619.43
7.1.50.0040.01817.18
7.1.00.0030.03322.59
7.0.200.0040.00416.77
7.0.140.0000.07321.98
7.0.60.0130.08019.94
7.0.50.0030.06717.91
7.0.40.0070.05319.98
7.0.30.0270.07720.32
7.0.20.0370.08720.09
7.0.10.0170.07720.09
7.0.00.0000.04720.27
5.6.280.0100.06721.07
5.6.210.0030.08720.49
5.6.200.0030.08318.16
5.6.190.0100.08020.78
5.6.180.0230.06720.46
5.6.170.0130.04720.54
5.6.160.0000.08320.43
5.6.150.0030.08318.14
5.6.140.0070.08318.21
5.6.130.0000.04718.21
5.6.120.0030.07720.99
5.6.110.0000.06321.07
5.6.100.0100.06321.01
5.6.90.0070.06320.96
5.6.80.0130.06720.54
5.5.350.0230.07720.42
5.5.340.0030.05017.95
5.5.330.0130.07320.57
5.5.320.0500.05320.25
5.5.310.0270.07020.27
5.5.300.0000.04717.99
5.5.290.0230.03717.94
5.5.280.0030.08020.77
5.5.270.0170.06020.77
5.5.260.0200.04720.88
5.5.250.0100.03720.57
5.5.240.0300.07320.27
5.4.450.3430.03719.41
5.4.440.0130.07019.32
5.4.430.3270.04319.45
5.4.420.3430.03319.27
5.4.410.3300.03719.29
5.4.400.3400.03319.16
5.4.390.3330.04019.01
5.4.380.3370.04018.98
5.4.370.2970.04018.88
5.4.360.2900.03719.06
5.4.350.3130.03019.32
5.4.340.2030.04019.24
5.4.320.1530.04019.08
5.4.310.3100.03719.09
5.4.300.2630.03719.31
5.4.290.2900.03719.21
5.4.280.3100.03319.09
5.4.270.3070.04018.85
5.4.260.3130.03019.22
5.4.250.3070.03718.97
5.4.240.3200.04018.98
5.4.230.3100.03719.13
5.4.220.3330.03718.84
5.4.210.3270.04019.08
5.4.200.3530.04718.87
5.4.190.3270.03319.07
5.4.180.3300.02719.30
5.4.170.3430.03718.86
5.4.160.3400.03719.17
5.4.150.3670.03318.83
5.4.140.3500.03316.37
5.4.130.3830.04316.32
5.4.120.3500.04016.34
5.4.110.3470.03016.54
5.4.100.3500.03316.55
5.4.90.2600.03716.42
5.4.80.3500.02716.49
5.4.70.3200.03316.17
5.4.60.3800.03016.38
5.4.50.3970.04016.34
5.4.40.3530.03316.51
5.4.30.3570.02716.15
5.4.20.3400.04016.16
5.4.10.3530.03316.22
5.4.00.4000.03715.98
5.3.290.2330.02314.71
5.3.280.3400.03314.51
5.3.270.2730.03714.61
5.3.260.3670.03714.50
5.3.250.3330.04314.63
5.3.240.3570.04014.52
5.3.230.4000.04014.50
5.3.220.3570.03014.57
5.3.210.3630.04014.72
5.3.200.3400.03714.79
5.3.190.3330.03314.68
5.3.180.3300.03714.48
5.3.170.3500.02714.57
5.3.160.3470.03014.61
5.3.150.3770.03014.57
5.3.140.4070.04314.55
5.3.130.3570.04014.52
5.3.120.3170.04014.63
5.3.110.3630.03714.66
5.3.100.4070.04014.15
5.3.90.3670.04713.99
5.3.80.3100.03714.18
5.3.70.3400.03314.24
5.3.60.3330.03314.22
5.3.50.3430.03313.86
5.3.40.3270.03314.17
5.3.30.4330.03013.91
5.3.20.3200.03313.62
5.3.10.3470.03313.67
5.3.00.3930.02713.56
5.2.170.2800.03011.24
5.2.160.2900.02710.97
5.2.150.3100.03011.30
5.2.140.3300.03711.19
5.2.130.2770.03010.94
5.2.120.2870.02711.27
5.2.110.2930.02310.94
5.2.100.2930.02710.96
5.2.90.2870.02310.99
5.2.80.2670.03311.03
5.2.70.3070.02710.98
5.2.60.3200.03710.96
5.2.50.3370.03310.86
5.2.40.2600.02011.09
5.2.30.2300.02710.88
5.2.20.3170.03011.12
5.2.10.2430.03010.77
5.2.00.2370.02710.68
5.1.60.2530.0209.96
5.1.50.2500.02310.07
5.1.40.2270.0239.95
5.1.30.2200.02310.25
5.1.20.2300.02310.21
5.1.10.1730.02710.08
5.1.00.2330.02310.04
5.0.50.0430.0208.64
5.0.40.0030.0178.46
5.0.30.0030.0308.13
5.0.20.0130.0308.09
5.0.10.0030.0208.15
5.0.00.0070.0308.28
4.4.90.1370.0206.33
4.4.80.1330.0136.33
4.4.70.1130.0236.33
4.4.60.1300.0206.33
4.4.50.1300.0176.33
4.4.40.1300.0236.33
4.4.30.1130.0176.33
4.4.20.1130.0176.33
4.4.10.1330.0206.33
4.4.00.0000.0276.33
4.3.110.0000.0406.33
4.3.100.0000.0176.33
4.3.90.0030.0206.33
4.3.80.0000.0276.33
4.3.70.1170.0136.33
4.3.60.1370.0136.33
4.3.50.1100.0136.33
4.3.40.1100.0276.33
4.3.30.0630.0206.33
4.3.20.0730.0276.33
4.3.10.0600.0176.33
4.3.00.0570.0176.33

preferences:
39.05 ms | 400 KiB | 5 Q