3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Filter { protected $pattern; protected $repl; function __construct($pattern, $repl) { $this->pattern = $pattern; $this->repl = $repl; } function filter($data) { return preg_replace($this->pattern, $this->repl, $data); } }; class Post { protected $title; protected $text; protected $filters; function __construct($title, $text, $filters) { $this->title = $title; $this->text = $text; $this->filters = $filters; } function get_title() { return htmlspecialchars($this->title); } function display_post() { $text = htmlspecialchars($this->text); foreach ($this->filters as $filter) $text = $filter->filter($text); return $text; } function __destruct() { // debugging stuff $s = "<!-- POST " . htmlspecialchars($this->title); $text = htmlspecialchars($this->text); foreach ($this->filters as $filter) $text = $filter->filter($text); $s = $s . ": " . $text; $s = $s . " -->"; echo $s; } }; $standard_filter_set = [new Filter("/\[i\](.*)\[\/i\]/i", "<i>\\1</i>"), new Filter("/\[b\](.*)\[\/b\]/i", "<b>\\1</b>"), new Filter("/\[img\](.*)\[\/img\]/i", "<img src='\\1'>"), new Filter("/\[br\]/i", "<br>")]; echo serialize(new Post("hue", "br", [new Filter("get shrekt", "get rekt")]));

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.0090.00618.68
8.3.50.0150.00321.14
8.3.40.0110.00718.80
8.3.30.0150.00319.21
8.3.20.0000.00720.35
8.3.10.0040.00423.53
8.3.00.0040.00419.38
8.2.180.0190.00016.75
8.2.170.0070.00722.96
8.2.160.0030.01020.43
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0030.00526.16
8.2.120.0000.00822.23
8.2.110.0030.00622.07
8.2.100.0040.00817.75
8.2.90.0040.00419.35
8.2.80.0030.00517.97
8.2.70.0060.00317.50
8.2.60.0050.00318.04
8.2.50.0030.00618.07
8.2.40.0040.00418.22
8.2.30.0030.00518.22
8.2.20.0020.00517.72
8.2.10.0050.00317.99
8.2.00.0040.00417.67
8.1.280.0030.01425.92
8.1.270.0040.00423.94
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0140.00323.98
8.1.230.0040.00819.10
8.1.220.0050.00517.74
8.1.210.0030.00618.77
8.1.200.0090.00017.23
8.1.190.0050.00317.36
8.1.180.0040.00418.10
8.1.170.0050.00318.59
8.1.160.0000.00722.11
8.1.150.0040.00418.87
8.1.140.0040.00417.46
8.1.130.0030.00317.91
8.1.120.0000.00817.50
8.1.110.0050.00517.50
8.1.100.0050.00217.55
8.1.90.0070.00517.50
8.1.80.0030.00517.40
8.1.70.0040.00417.51
8.1.60.0000.01117.52
8.1.50.0040.00417.61
8.1.40.0000.00917.55
8.1.30.0050.00317.69
8.1.20.0030.00517.71
8.1.10.0040.00417.48
8.1.00.0040.00417.59
8.0.300.0080.00018.77
8.0.290.0040.00416.88
8.0.280.0040.00418.42
8.0.270.0040.00417.37
8.0.260.0000.00617.21
8.0.250.0040.00417.02
8.0.240.0030.00317.07
8.0.230.0070.00017.08
8.0.220.0000.00716.90
8.0.210.0000.00617.00
8.0.200.0070.00017.05
8.0.190.0080.00017.04
8.0.180.0050.00317.09
8.0.170.0070.00017.05
8.0.160.0000.00717.05
8.0.150.0000.00917.02
8.0.140.0080.00016.89
8.0.130.0030.00313.43
8.0.120.0000.00716.94
8.0.110.0040.00416.96
8.0.100.0070.00017.04
8.0.90.0000.00716.79
8.0.80.0070.01416.97
8.0.70.0050.00316.97
8.0.60.0000.00717.07
8.0.50.0000.00716.91
8.0.30.0150.00317.13
8.0.20.0060.01317.40
8.0.10.0080.00016.95
8.0.00.0120.00816.92
7.4.330.0050.00015.03
7.4.320.0030.00316.66
7.4.300.0000.00616.63
7.4.290.0000.00716.46
7.4.280.0000.00716.54
7.4.270.0030.00316.56
7.4.260.0000.00716.53
7.4.250.0000.00816.56
7.4.240.0000.00716.61
7.4.230.0000.00716.77
7.4.220.0110.00816.68
7.4.210.0030.01016.50
7.4.200.0000.00816.63
7.4.160.0080.01016.56
7.4.150.0090.00917.40
7.4.140.0130.00517.86
7.4.130.0160.00516.49
7.4.120.0100.00716.55
7.4.110.0070.01016.38
7.4.100.0100.00716.41
7.4.90.0090.00916.52
7.4.80.0150.00619.39
7.4.70.0160.00716.52
7.4.60.0180.00616.57
7.4.50.0040.00416.47
7.4.40.0100.00716.72
7.4.30.0030.01316.67
7.4.00.0070.00715.18
7.3.330.0000.00613.48
7.3.320.0000.00513.42
7.3.310.0030.00616.43
7.3.300.0030.00316.27
7.3.290.0130.00516.38
7.3.280.0090.00716.42
7.3.270.0040.01417.40
7.3.260.0140.00916.45
7.3.250.0120.00716.56
7.3.240.0090.00616.47
7.3.230.0060.01016.41
7.3.210.0060.00916.38
7.3.200.0070.00519.39
7.3.190.0090.01016.57
7.3.180.0060.01216.48
7.3.170.0030.01316.32
7.3.160.0090.00616.43
7.2.330.0120.00616.57
7.2.320.0090.00916.66
7.2.310.0130.00916.60
7.2.300.0190.00416.43
7.2.290.0090.01516.81
7.2.60.0040.01117.05
7.2.00.0030.00919.20
7.1.200.0070.00715.82
7.1.100.0030.01418.26
7.1.70.0000.00817.26
7.1.60.0150.00919.11
7.1.50.0090.01516.85
7.1.00.0000.08022.43
7.0.200.0040.00816.86
7.0.140.0000.07022.07
7.0.60.0100.08019.88
7.0.50.0000.04317.86
7.0.40.0000.06020.24
7.0.30.0300.07720.26
7.0.20.0200.08320.07
7.0.10.0070.04720.22
7.0.00.0030.04720.09
5.6.280.0070.07021.01
5.6.210.0070.08020.57
5.6.200.0070.03718.16
5.6.190.0030.04720.41
5.6.180.0100.06720.54
5.6.170.0130.04720.64
5.6.160.0070.07020.50
5.6.150.0100.05718.21
5.6.140.0030.04018.22
5.6.130.0130.07318.18
5.6.120.0100.07321.01
5.6.110.0070.04021.05
5.6.100.0070.04321.02
5.6.90.0070.07320.98
5.6.80.0070.06320.38
5.5.350.0230.07720.38
5.5.340.0100.07718.09
5.5.330.0030.05720.21
5.5.320.0270.07720.38
5.5.310.0300.04320.20
5.5.300.0030.04018.06
5.5.290.0100.07717.96
5.5.280.0030.04720.78
5.5.270.0100.07320.66
5.5.260.0100.08320.69
5.5.250.0100.08320.70
5.5.240.0270.06020.15
5.4.450.0200.06019.43
5.4.440.0230.05319.30
5.4.430.0200.08319.54
5.4.420.0200.05319.54
5.4.410.0230.05719.44
5.4.400.0200.04318.82
5.4.390.0230.04019.09
5.4.380.0200.05018.98
5.4.370.0130.06719.32
5.4.360.0400.05318.94
5.4.350.0230.05319.14
5.4.340.0100.05019.09
5.4.320.0270.04718.89
5.4.310.0300.04019.22
5.4.300.0170.03719.24
5.4.290.0270.06719.08
5.4.280.0270.07319.16
5.4.270.0270.06719.31
5.4.260.0200.05318.85
5.4.250.0230.04019.08
5.4.240.0230.07319.13
5.4.230.0200.05018.97
5.4.220.0230.05019.15
5.4.210.0230.07319.23
5.4.200.0230.05018.97
5.4.190.0200.03719.19
5.4.180.0270.07019.13
5.4.170.0230.06718.94
5.4.160.0270.04719.30
5.4.150.0200.07018.95
5.4.140.0230.07016.55
5.4.130.0270.06016.46
5.4.120.0270.06716.40
5.4.110.0200.07316.52
5.4.100.0270.05716.30
5.4.90.0200.04716.61
5.4.80.0230.06716.51
5.4.70.0330.03716.49
5.4.60.0200.06716.34
5.4.50.0230.06716.32
5.4.40.0230.03716.54
5.4.30.0230.07316.43
5.4.20.0200.04316.24
5.4.10.0270.05716.50
5.4.00.0200.04716.11
5.3.290.0230.06314.80
5.3.280.0230.05314.77
5.3.270.0200.05014.55
5.3.260.0270.07314.53
5.3.250.0230.07014.52
5.3.240.0230.07014.64
5.3.230.0230.05314.60
5.3.220.0270.06714.59
5.3.210.0230.07314.60
5.3.200.0230.07014.57
5.3.190.0300.06714.69
5.3.180.0300.06014.50
5.3.170.0170.07014.52
5.3.160.0230.04714.50
5.3.150.0200.04714.65
5.3.140.0230.07314.54
5.3.130.0330.03714.47
5.3.120.0300.04314.54
5.3.110.0270.05014.66
5.3.100.0170.05313.95
5.3.90.0230.07014.16
5.3.80.0200.05014.04
5.3.70.0270.05314.18
5.3.60.0170.05313.96
5.3.50.0100.04714.04
5.3.40.0200.05013.86
5.3.30.0330.06313.94
5.3.20.0200.06313.63
5.3.10.0270.03013.83
5.3.00.0170.03713.57
5.2.170.0170.02713.36
5.2.160.0200.06313.36
5.2.150.0170.04013.36
5.2.140.0100.03313.36
5.2.130.0300.03013.36
5.2.120.0170.06013.36
5.2.110.0170.03013.36
5.2.100.0170.06313.36
5.2.90.0170.04013.36
5.2.80.0270.02713.36
5.2.70.0200.05313.36
5.2.60.0230.03013.36
5.2.50.0200.04013.36
5.2.40.0170.05013.36
5.2.30.0130.05313.36
5.2.20.0100.04013.36
5.2.10.0270.04313.36
5.2.00.0100.03713.36
5.1.60.0170.02713.36
5.1.50.0100.04313.36
5.1.40.0200.03013.36
5.1.30.0130.03313.36
5.1.20.0100.06013.36
5.1.10.0200.04313.36
5.1.00.0070.03713.36
5.0.50.0130.02313.36
5.0.40.0070.04713.36
5.0.30.0100.05013.36
5.0.20.0170.03713.36
5.0.10.0200.03013.36
5.0.00.0130.05713.36
4.4.90.0170.01713.36
4.4.80.0070.02313.36
4.4.70.0070.03713.36
4.4.60.0030.04013.36
4.4.50.0100.02713.36
4.4.40.0070.05313.36
4.4.30.0030.02313.36
4.4.20.0070.03313.36
4.4.10.0030.02313.36
4.4.00.0130.04313.36
4.3.110.0070.03713.36
4.3.100.0070.03013.36
4.3.90.0070.02713.36
4.3.80.0030.03313.36
4.3.70.0070.02313.36
4.3.60.0100.02313.36
4.3.50.0070.03713.36
4.3.40.0100.04313.36
4.3.30.0030.04013.36
4.3.20.0000.02013.36
4.3.10.0030.03313.36
4.3.00.0030.02013.36

preferences:
38.4 ms | 401 KiB | 5 Q