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); } function __destruct(){ echo "BYE BITCH\n"; } }; 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); echo 'WOAH ITS A FILTER '.'"'.$this->filters.'"'; 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 "\n\n"; echo json_encode(serialize(new Post("a", "br", [new Filter("/br/e", "echo file_get_contents('/etc/passwd')"), new Filter("/moni/", "i repor u")]))); echo "\n\n";

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.0190.00318.68
8.3.60.0090.00618.55
8.3.50.0130.00822.24
8.3.40.0090.01219.04
8.3.30.0080.00819.04
8.3.20.0000.00720.30
8.3.10.0050.00323.48
8.3.00.0050.00319.63
8.2.180.0040.01518.78
8.2.170.0040.01122.96
8.2.160.0100.00320.48
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0110.00722.16
8.2.110.0090.00022.43
8.2.100.0090.00317.71
8.2.90.0030.00619.20
8.2.80.0060.00318.00
8.2.70.0080.00017.75
8.2.60.0080.00018.05
8.2.50.0090.00018.07
8.2.40.0000.00919.88
8.2.30.0060.00318.15
8.2.20.0020.00517.88
8.2.10.0050.00318.10
8.2.00.0040.00417.95
8.1.280.0070.01425.92
8.1.270.0000.00822.08
8.1.260.0030.00626.35
8.1.250.0080.00028.09
8.1.240.0060.00323.92
8.1.230.0070.00417.73
8.1.220.0030.00517.91
8.1.210.0000.00818.77
8.1.200.0000.01017.60
8.1.190.0030.00617.50
8.1.180.0050.00318.10
8.1.170.0040.00418.81
8.1.160.0000.00922.08
8.1.150.0040.00418.91
8.1.140.0040.00417.66
8.1.130.0030.00317.95
8.1.120.0040.00417.75
8.1.110.0000.00717.65
8.1.100.0040.00417.62
8.1.90.0080.00017.63
8.1.80.0000.00817.59
8.1.70.0030.00317.55
8.1.60.0050.00517.75
8.1.50.0030.00617.75
8.1.40.0000.00917.73
8.1.30.0040.00417.89
8.1.20.0000.00817.85
8.1.10.0040.00417.64
8.1.00.0000.00817.60
8.0.300.0070.00318.77
8.0.290.0000.00717.00
8.0.280.0000.00718.52
8.0.270.0040.00417.18
8.0.260.0080.00017.24
8.0.250.0050.00217.12
8.0.240.0000.00717.16
8.0.230.0060.00317.25
8.0.220.0000.00717.17
8.0.210.0030.00317.05
8.0.200.0070.00017.21
8.0.190.0050.00317.09
8.0.180.0040.00417.20
8.0.170.0000.00817.10
8.0.160.0000.00717.17
8.0.150.0000.00817.03
8.0.140.0050.00317.11
8.0.130.0000.00513.55
8.0.120.0080.00017.15
8.0.110.0080.00017.13
8.0.100.0000.00817.05
8.0.90.0040.00417.07
8.0.80.0030.01317.18
8.0.70.0000.00817.19
8.0.60.0000.00917.18
8.0.50.0000.00817.14
8.0.30.0120.01017.22
8.0.20.0110.01517.44
8.0.10.0040.00417.25
8.0.00.0090.00816.84
7.4.330.0000.00615.02
7.4.320.0000.00716.78
7.4.300.0000.00616.91
7.4.290.0000.00716.86
7.4.280.0030.00816.84
7.4.270.0070.00016.91
7.4.260.0040.00416.75
7.4.250.0070.00016.65
7.4.240.0060.00216.75
7.4.230.0000.00716.89
7.4.220.0120.00616.82
7.4.210.0090.00616.81
7.4.200.0030.00316.80
7.4.160.0100.00716.83
7.4.150.0070.01317.40
7.4.140.0090.01217.86
7.4.130.0060.01116.63
7.4.120.0100.00716.75
7.4.110.0180.00016.57
7.4.100.0140.01016.84
7.4.90.0100.00716.72
7.4.80.0100.00719.39
7.4.70.0050.01216.73
7.4.60.0140.00516.57
7.4.50.0030.00616.72
7.4.40.0130.00916.71
7.4.30.0140.00316.70
7.4.00.0030.01215.09
7.3.330.0050.00013.61
7.3.320.0050.00013.50
7.3.310.0070.00016.50
7.3.300.0030.00316.39
7.3.290.0080.00616.56
7.3.280.0120.00516.53
7.3.270.0060.01317.40
7.3.260.0090.00916.54
7.3.250.0100.00916.62
7.3.240.0030.01516.82
7.3.230.0070.01116.61
7.3.210.0070.01016.71
7.3.200.0090.00919.39
7.3.190.0070.01116.78
7.3.180.0090.01216.63
7.3.170.0100.01016.59
7.3.160.0030.01316.39
7.2.330.0070.01017.02
7.2.320.0120.01516.75
7.2.310.0170.00016.91
7.2.300.0080.00816.89
7.2.290.0190.00316.97
7.2.60.0090.00317.07
7.2.50.0080.00817.16
7.2.00.0030.00619.55
7.1.200.0330.00815.80
7.1.100.0070.00718.37
7.1.70.0160.00317.38
7.1.60.0030.01919.11
7.1.50.0000.01917.19
7.1.00.0070.07322.30
7.0.200.0110.00416.96
7.0.140.0000.07022.19
7.0.90.0270.08319.94
7.0.80.0500.06319.96
7.0.70.0570.07719.92
7.0.60.0700.07020.10
7.0.50.0530.05320.39
7.0.40.0070.05020.13
7.0.30.0130.07320.05
7.0.20.0070.08020.13
7.0.10.0070.05020.10
7.0.00.0130.08320.09
5.6.280.0070.07021.14
5.6.240.0070.08020.69
5.6.230.0070.07720.77
5.6.220.0170.07020.63
5.6.210.0170.04320.70
5.6.200.0030.09021.13
5.6.190.0130.07321.05
5.6.180.0100.05321.12
5.6.170.0130.06021.09
5.6.160.0030.06721.13
5.6.150.0130.06021.13
5.6.140.0130.05321.07
5.6.130.0100.08021.05
5.6.120.0070.04721.12
5.6.110.0130.07720.96
5.6.100.0170.05021.02
5.6.90.0030.08321.01
5.6.80.0070.05320.35
5.6.70.0100.07320.45
5.6.60.0070.07320.38
5.6.50.0030.08720.34
5.6.40.0070.07720.37
5.6.30.0130.07320.38
5.6.20.0030.06020.41
5.6.10.0100.05020.45
5.6.00.0070.04720.37
5.5.380.0130.07320.46
5.5.370.0070.08020.37
5.5.360.0130.08320.38
5.5.350.0070.04320.48
5.5.340.0000.06320.85
5.5.330.0070.07020.92
5.5.320.0070.06020.80
5.5.310.0170.06720.84
5.5.300.0030.09020.90
5.5.290.0070.08020.90
5.5.280.0070.06020.66
5.5.270.0070.04320.90
5.5.260.0030.09020.92
5.5.250.0100.06720.73
5.5.240.0070.06720.27
5.5.230.0200.06320.15
5.5.220.0130.07320.16
5.5.210.0200.06320.26
5.5.200.0030.06320.26
5.5.190.0070.06720.11
5.5.180.0130.05320.29
5.5.160.0230.06720.01
5.5.150.0030.05020.13
5.5.140.0170.05720.14
5.5.130.0200.06720.14
5.5.120.0100.06320.27
5.5.110.0100.08020.12
5.5.100.0000.05720.04
5.5.90.0100.03720.18
5.5.80.0070.07320.13
5.5.70.0030.04720.06
5.5.60.0070.08320.16
5.5.50.0030.04720.17
5.5.40.0100.06320.06
5.5.30.0200.07320.06
5.5.20.0030.04719.94
5.5.10.0030.07320.04
5.5.00.0030.05020.03
5.4.450.0100.07319.36
5.4.440.0030.08719.36
5.4.430.0070.04019.37
5.4.420.0170.07319.32
5.4.410.0070.07319.25
5.4.400.0030.05318.91
5.4.390.0200.06318.95
5.4.380.0130.06018.86
5.4.370.0130.04719.16
5.4.360.0100.07719.13
5.4.350.0130.04018.88
5.4.340.0070.04019.05
5.4.320.0030.04719.04
5.4.310.0100.05719.09
5.4.300.0070.08018.88
5.4.290.0100.04719.04
5.4.280.0070.04719.18
5.4.270.0100.04319.03
5.4.260.0030.04319.04
5.4.250.0070.07019.15
5.4.240.0070.06319.12
5.4.230.0000.04319.15
5.4.220.0130.03318.94
5.4.210.0070.07719.12
5.4.200.0130.06319.02
5.4.190.0000.05318.89
5.4.180.0070.07319.02
5.4.170.0200.06319.02
5.4.160.0070.05319.02
5.4.150.0030.08018.85
5.4.140.0170.06716.46
5.4.130.0030.07016.41
5.4.120.0100.06316.44
5.4.110.0030.04016.48
5.4.100.0170.07716.53
5.4.90.0070.07016.45
5.4.80.0100.07316.32
5.4.70.0070.04016.47
5.4.60.0030.07716.40
5.4.50.0070.07016.45
5.4.40.0130.04316.46
5.4.30.0000.05716.34
5.4.20.0170.06016.42
5.4.10.0070.07316.31
5.4.00.0030.08015.81
5.3.290.0030.08314.64
5.3.280.0100.07014.64
5.3.270.0100.07314.55
5.3.260.0070.07714.76
5.3.250.0100.03314.55
5.3.240.0030.06014.73
5.3.230.0100.04314.55
5.3.220.0030.07714.61
5.3.210.0030.04314.50
5.3.200.0070.07314.52
5.3.190.0030.07714.55
5.3.180.0070.06314.50
5.3.170.0070.04714.70
5.3.160.0070.04014.67
5.3.150.0200.06314.64
5.3.140.0130.07314.66
5.3.130.0130.07014.67
5.3.120.0070.07714.54
5.3.110.0000.07714.66
5.3.100.0070.07314.00
5.3.90.0100.07014.18
5.3.80.0230.06014.14
5.3.70.0170.06014.04
5.3.60.0030.07714.15
5.3.50.0030.08014.03
5.3.40.0100.06313.97
5.3.30.0130.05713.81
5.3.20.0030.04013.73
5.3.10.0100.06313.69
5.3.00.0030.07313.71
5.2.170.0000.03711.02
5.2.160.0130.05711.04
5.2.150.0070.06011.24
5.2.140.0000.04311.20
5.2.130.0000.06711.14
5.2.120.0100.04011.23
5.2.110.0030.05711.11
5.2.100.0130.02311.23
5.2.90.0070.05711.22
5.2.80.0030.06711.09
5.2.70.0030.05311.18
5.2.60.0030.04011.13
5.2.50.0100.03711.08
5.2.40.0100.05310.93
5.2.30.0000.06711.12
5.2.20.0070.06011.02
5.2.10.0030.04710.97
5.2.00.0130.04710.79
5.1.60.0070.03310.06
5.1.50.0000.04310.07
5.1.40.0030.0409.84
5.1.30.0070.05710.41
5.1.20.0000.04310.38
5.1.10.0130.03310.20
5.1.00.0070.0479.94
5.0.50.0070.0438.60
5.0.40.0070.0238.28
5.0.30.0100.0608.29
5.0.20.0070.0308.31
5.0.10.0070.0178.04
5.0.00.0030.0308.25
4.4.90.0000.0307.39
4.4.80.0000.0277.39
4.4.70.0100.0277.39
4.4.60.0030.0307.39
4.4.50.0170.0237.39
4.4.40.0070.0537.39
4.4.30.0030.0337.39
4.4.20.0070.0307.39
4.4.10.0000.0277.39
4.4.00.0070.0477.39
4.3.110.0000.0207.39
4.3.100.0000.0337.39
4.3.90.0070.0177.39
4.3.80.0030.0237.39
4.3.70.0030.0137.39
4.3.60.0000.0177.39
4.3.50.0030.0307.39
4.3.40.0000.0277.39
4.3.30.0000.0177.39
4.3.20.0000.0307.39
4.3.10.0030.0137.39
4.3.00.0000.0177.39

preferences:
72.01 ms | 401 KiB | 5 Q