3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sentence = '[html style="font-size: 18px;" dir="ltr"][div style="font-size: 18px;" dir="ltr"][p style="font-weight: bold;"]Hello,[/p][p]You have got a new message from [a href="https://www.example.com/"]Example.com[/a][br][br].You could check your message on [a href="https://www.example.com/en/manager/inbox.html"]Manager[/a][/p][p][img src="https://www.example.com/assets/images/logo-default-120x50.png" width="120px" height="80px"][div style="color: #D4192D; font-weight: bold;"]Example.com Team[/div][/p][/div][/html]'; // proceed to the replacement of all self-closing tags first $result = preg_replace('~\[ (br|hr|img)\b ([^]]*) ]~xi', '<$1$2/>', $sentence); // then replace the innermost tags until there's nothing to replace $count = 0; do { $result = preg_replace('~ \[ ( (\w+) [^]]* ) ] # opening tag ( [^[]*+ ) # content without other bracketed tags \[/ \2 ] # closing tag ~xi', '<$1>$3</$2>', $result, -1, $count); } while ($count); echo $result;

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.5.10.0110.00816.82
8.5.00.0130.00820.09
8.4.150.0020.00014.05
8.4.140.0100.01417.62
8.4.130.0110.00918.73
8.4.120.0110.00824.09
8.4.110.0140.00622.65
8.4.100.0170.00618.10
8.4.90.0080.00118.06
8.4.80.0090.01217.83
8.4.70.0030.00617.94
8.4.60.0120.00818.50
8.4.50.0100.00817.72
8.4.40.0190.00017.99
8.4.30.0120.00820.59
8.4.20.0080.00318.20
8.4.10.0090.00019.79
8.3.280.0140.00718.57
8.3.270.0100.01016.41
8.3.260.0090.00916.82
8.3.250.0040.00418.70
8.3.240.0050.00316.98
8.3.230.0120.00816.80
8.3.220.0040.00416.59
8.3.210.0040.00416.62
8.3.200.0060.00318.77
8.3.190.0100.00917.37
8.3.180.0100.01016.69
8.3.170.0110.00716.59
8.3.160.0070.01018.57
8.3.150.0100.00616.91
8.3.140.0090.00918.91
8.3.130.0030.00518.36
8.3.120.0030.00618.80
8.3.110.0000.00820.94
8.3.100.0070.01316.94
8.3.90.0040.00426.77
8.3.80.0060.00316.88
8.3.70.0100.00716.58
8.3.60.0070.00718.18
8.3.50.0110.00620.01
8.3.40.0150.00018.67
8.3.30.0110.00418.92
8.3.20.0050.00324.18
8.3.10.0080.00024.66
8.3.00.0080.00026.16
8.2.290.0100.00920.58
8.2.280.0110.00618.66
8.2.270.0140.00416.88
8.2.260.0090.00018.61
8.2.250.0040.00416.81
8.2.240.0030.00617.17
8.2.230.0030.00522.58
8.2.220.0110.00724.06
8.2.210.0100.01026.77
8.2.200.0030.00618.54
8.2.190.0130.00616.75
8.2.180.0140.00425.92
8.2.170.0040.01119.09
8.2.160.0030.01022.96
8.2.150.0080.00025.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0070.01321.08
8.2.110.0040.00721.17
8.2.100.0110.00017.91
8.2.90.0040.00417.91
8.2.80.0080.00017.97
8.2.70.0000.00917.63
8.2.60.0070.00418.05
8.2.50.0060.00318.07
8.2.40.0040.00418.10
8.2.30.0000.00817.98
8.2.20.0040.00419.47
8.2.10.0030.00617.98
8.2.00.0000.01019.32
8.1.330.0060.00521.84
8.1.320.0140.00516.05
8.1.310.0070.00718.27
8.1.300.0040.01518.21
8.1.290.0050.00530.84
8.1.280.0000.01425.92
8.1.270.0070.00023.99
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00622.44
8.1.230.0080.00420.91
8.1.220.0080.00017.79
8.1.210.0080.00018.88
8.1.200.0050.00517.35
8.1.190.0030.00517.23
8.1.180.0080.00018.10
8.1.170.0000.00818.64
8.1.160.0040.00418.77
8.1.150.0040.00418.66
8.1.140.0060.00317.42
8.1.130.0040.00418.88
8.1.120.0050.00517.48
8.1.110.0080.00017.60
8.1.100.0070.00017.57
8.1.90.0000.00817.59
8.1.80.0120.00017.44
8.1.70.0000.00717.46
8.1.60.0040.00417.54
8.1.50.0030.00517.58
8.1.40.0040.00817.65
8.1.30.0050.00317.81
8.1.20.0040.00417.75
8.1.10.0060.00317.73
8.1.00.0050.00217.61
8.0.300.0000.00719.98
8.0.290.0000.00816.75
8.0.280.0000.00718.53
8.0.270.0040.00416.93
8.0.260.0060.00018.39
8.0.250.0040.00417.09
8.0.240.0000.00717.05
8.0.230.0050.00317.03
8.0.220.0030.00317.04
8.0.210.0000.00816.98
8.0.200.0050.00217.01
8.0.190.0050.00317.07
8.0.180.0040.00417.02
8.0.170.0000.00917.00
8.0.160.0040.00416.99
8.0.150.0070.00016.96
8.0.140.0000.00716.93
8.0.130.0000.00613.41
8.0.120.0080.00413.38
8.0.110.0080.00413.47
8.0.100.0070.00313.42
8.0.90.0100.00213.44
8.0.80.0060.00613.38
8.0.70.0090.00013.42
8.0.60.0030.00613.44
8.0.50.0050.00513.36
8.0.30.0090.00313.42
8.0.20.0100.00313.52
8.0.10.0120.00013.52
8.0.00.0040.00413.63
7.4.330.0050.00015.55
7.4.320.0000.00716.64
7.4.300.0000.00616.77
7.4.290.0040.00416.60
7.4.280.0040.00416.67
7.4.270.0080.00016.77
7.4.260.0030.00313.45
7.4.250.0120.00313.44
7.4.240.0110.00213.56
7.4.230.0100.00313.50
7.4.220.0090.00313.52
7.4.210.0060.00613.49
7.4.200.0080.00413.52
7.4.190.0120.00013.62
7.4.180.0090.00313.52
7.4.160.0100.00213.50
7.4.150.0060.00613.51
7.4.140.0120.00013.48
7.4.130.0060.00613.51
7.4.120.0080.00313.39
7.4.110.0110.00013.46
7.4.100.0090.00213.27
7.4.90.0110.00013.40
7.4.80.0100.00013.41
7.4.70.0080.00313.39
7.4.60.0070.00313.05
7.4.50.0080.00413.37
7.4.40.0090.00313.30
7.4.30.0100.00013.43
7.4.20.0110.00013.29
7.4.10.0050.00513.24
7.4.00.0030.00613.44
7.3.330.0050.00216.34
7.3.320.0070.00213.17
7.3.310.0000.01113.15
7.3.300.0030.00713.18
7.3.290.0040.00413.24
7.3.280.0110.00013.10
7.3.270.0040.00813.27
7.3.260.0040.00813.22
7.3.250.0110.00213.30
7.3.240.0050.00913.20
7.3.230.0090.00413.29
7.3.220.0090.00413.04
7.3.210.0060.00713.04
7.3.200.0130.00013.05
7.3.190.0060.00613.06
7.3.180.0100.00413.14
7.3.170.0080.00413.14
7.3.160.0060.00613.14
7.3.150.0070.00313.05
7.3.140.0080.00313.18
7.3.130.0090.00012.96
7.3.120.0040.00412.98
7.3.110.0060.00312.95
7.3.100.0030.00612.95
7.3.90.0080.00013.38
7.3.80.0030.00613.20
7.3.70.0040.00413.22
7.3.60.0030.00613.23
7.3.50.0100.00013.32
7.3.40.0080.00013.23
7.3.30.0000.00913.41
7.3.20.0060.00315.04
7.3.10.0060.00314.93
7.3.00.0030.00615.09

preferences:
49.35 ms | 403 KiB | 5 Q