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", "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.60.0060.00918.68
8.3.50.0120.00821.19
8.3.40.0060.00919.27
8.3.30.0150.00019.13
8.3.20.0040.00420.43
8.3.10.0040.00423.70
8.3.00.0040.00419.51
8.2.180.0040.01118.53
8.2.170.0070.00722.96
8.2.160.0060.00820.60
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0020.00526.16
8.2.120.0040.00422.25
8.2.110.0100.01322.38
8.2.100.0120.00018.00
8.2.90.0080.00019.36
8.2.80.0000.00817.97
8.2.70.0040.00417.87
8.2.60.0000.00818.02
8.2.50.0000.00818.07
8.2.40.0080.00019.95
8.2.30.0030.00518.13
8.2.20.0050.00318.06
8.2.10.0000.00818.18
8.2.00.0000.00718.01
8.1.280.0110.01125.92
8.1.270.0060.00322.27
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0070.01423.87
8.1.230.0090.00319.26
8.1.220.0030.00617.88
8.1.210.0000.00918.77
8.1.200.0030.00617.48
8.1.190.0040.00417.60
8.1.180.0000.00818.10
8.1.170.0030.00618.84
8.1.160.0080.00022.01
8.1.150.0070.00018.96
8.1.140.0040.00417.65
8.1.130.0040.00417.91
8.1.120.0050.00217.57
8.1.110.0040.00417.71
8.1.100.0030.00517.71
8.1.90.0000.01017.63
8.1.80.0040.00417.71
8.1.70.0000.00717.52
8.1.60.0090.00017.74
8.1.50.0000.00817.74
8.1.40.0040.00417.66
8.1.30.0030.00617.93
8.1.20.0040.00417.77
8.1.10.0040.00417.80
8.1.00.0050.00317.71
8.0.300.0000.00918.77
8.0.290.0070.00017.13
8.0.280.0040.00418.52
8.0.270.0000.00717.21
8.0.260.0030.00317.38
8.0.250.0040.00417.26
8.0.240.0030.00317.28
8.0.230.0030.00617.19
8.0.220.0000.00817.12
8.0.210.0000.00717.13
8.0.200.0030.00317.10
8.0.190.0040.00417.11
8.0.180.0090.00017.14
8.0.170.0000.00717.11
8.0.160.0070.00017.11
8.0.150.0030.00617.03
8.0.140.0000.00717.14
8.0.130.0060.00013.59
8.0.120.0000.00917.04
8.0.110.0040.00417.09
8.0.100.0000.00717.21
8.0.90.0040.00417.19
8.0.80.0060.01317.04
8.0.70.0000.00817.20
8.0.60.0040.00417.10
8.0.50.0050.00317.02
8.0.30.0080.01117.25
8.0.20.0090.01517.42
8.0.10.0000.00717.15
8.0.00.0070.01116.88
7.4.330.0060.00015.02
7.4.320.0000.00616.86
7.4.300.0030.00316.66
7.4.290.0000.00716.84
7.4.280.0060.00316.89
7.4.270.0070.00016.74
7.4.260.0030.00516.80
7.4.250.0080.00016.76
7.4.240.0040.00416.77
7.4.230.0070.00016.82
7.4.220.0150.00616.70
7.4.210.0070.00716.89
7.4.200.0000.00716.75
7.4.160.0080.00816.77
7.4.150.0040.01817.40
7.4.140.0100.01017.86
7.4.130.0060.01416.72
7.4.120.0070.01316.89
7.4.110.0060.01616.65
7.4.100.0110.00716.73
7.4.90.0070.01016.80
7.4.80.0120.01219.39
7.4.70.0100.00616.80
7.4.60.0090.00916.91
7.4.50.0080.00016.63
7.4.40.0060.01616.92
7.4.30.0140.00516.91
7.4.00.0030.01015.33
7.3.330.0030.00313.61
7.3.320.0030.00313.61
7.3.310.0000.00716.44
7.3.300.0030.00316.50
7.3.290.0040.01316.54
7.3.280.0080.00816.49
7.3.270.0100.01417.40
7.3.260.0120.00816.61
7.3.250.0070.01016.70
7.3.240.0130.00916.77
7.3.230.0110.00716.73
7.3.210.0080.00816.91
7.3.200.0060.01319.39
7.3.190.0130.01016.48
7.3.180.0040.01216.66
7.3.170.0070.01016.89
7.3.160.0110.00516.50
7.3.00.0040.01116.66
7.2.330.0030.01516.87
7.2.320.0120.01216.94
7.2.310.0120.00617.02
7.2.300.0100.00716.93
7.2.290.0120.00616.98
7.2.130.0160.00617.04
7.2.120.0150.00416.88
7.2.110.0180.00016.99
7.2.100.0140.00317.04
7.2.90.0030.01516.95
7.2.80.0040.01517.09
7.2.70.0140.00016.98
7.2.60.0080.00817.19
7.2.50.0070.00716.80
7.2.40.0040.01517.06
7.2.30.0140.00716.96
7.2.20.0070.01016.80
7.2.10.0200.00417.16
7.2.00.0030.01417.05
7.1.250.0030.01115.92
7.1.240.0060.01015.91
7.1.230.0000.01215.87
7.1.220.0080.00815.85
7.1.210.0030.01216.02
7.1.200.0140.00615.94
7.1.190.0160.00015.96
7.1.180.0030.01315.64
7.1.170.0100.01315.77
7.1.160.0100.01315.78
7.1.150.0030.00915.88
7.1.140.0100.00715.85
7.1.130.0040.01115.94
7.1.120.0160.00615.78
7.1.110.0030.01316.03
7.1.100.0100.00615.97
7.1.90.0100.00715.96
7.1.80.0000.01815.97
7.1.70.0050.01216.55
7.1.60.0090.00917.58
7.1.50.0130.00616.32
7.1.40.0100.01015.68
7.1.30.0050.00515.81
7.1.20.0060.00915.82
7.1.10.0100.00715.51
7.1.00.0070.04019.06
7.0.330.0030.01315.51
7.0.320.0040.01215.55
7.0.310.0130.00315.42
7.0.300.0080.00515.36
7.0.290.0080.00815.49
7.0.280.0030.00815.54
7.0.270.0080.00815.39
7.0.260.0060.00615.49
7.0.250.0170.00315.43
7.0.240.0060.00915.57
7.0.230.0130.00315.19
7.0.220.0060.01115.21
7.0.210.0100.01015.47
7.0.200.0150.00316.37
7.0.190.0060.00815.39
7.0.180.0040.01115.73
7.0.170.0100.00615.21
7.0.160.0100.00315.61
7.0.150.0040.00715.57
7.0.140.0090.03818.87
7.0.130.0070.00715.30
7.0.120.0110.00415.38
7.0.110.0120.00615.31
7.0.100.0090.00615.38
7.0.90.0190.03217.66
7.0.80.0080.04517.79
7.0.70.0200.03917.56
7.0.60.0180.04217.57
7.0.50.0250.04018.01
7.0.40.0030.04816.87
7.0.30.0070.03416.77
7.0.20.0050.04416.83
7.0.10.0070.04716.77
7.0.00.0080.03716.85
5.6.380.0150.00414.36
5.6.370.0140.00314.11
5.6.360.0060.00914.66
5.6.350.0060.00614.40
5.6.340.0030.01014.67
5.6.330.0070.01114.09
5.6.320.0000.01214.33
5.6.310.0060.00914.58
5.6.300.0070.01114.30
5.6.290.0000.01314.36
5.6.280.0110.03517.65
5.6.270.0070.01014.54
5.6.260.0080.00814.67
5.6.250.0030.01214.53
5.6.240.0030.04617.39
5.6.230.0110.04117.49
5.6.220.0080.03517.60
5.6.210.0070.04817.56
5.6.200.0070.03517.60
5.6.190.0030.04917.79
5.6.180.0050.03417.79
5.6.170.0100.03017.71
5.6.160.0110.02517.62
5.6.150.0140.04017.76
5.6.140.0090.02817.66
5.6.130.0070.04817.76
5.6.120.0060.04817.77
5.6.110.0070.03117.72
5.6.100.0030.04917.60
5.6.90.0030.03217.72
5.6.80.0040.03117.37
5.6.70.0090.04017.48
5.6.60.0100.04417.49
5.6.50.0040.04417.46
5.6.40.0120.04217.43
5.6.30.0100.04017.42
5.6.20.0090.04417.48
5.6.10.0080.02517.42
5.6.00.0040.03417.25
5.5.380.0080.02415.73
5.5.370.0080.03515.82
5.5.360.0030.04915.94
5.5.350.0120.03715.79
5.5.340.0030.02915.98
5.5.330.0070.04516.10
5.5.320.0130.02515.90
5.5.310.0090.03815.95
5.5.300.0060.02516.02
5.5.290.0050.03115.93
5.5.280.0100.03116.10
5.5.270.0080.04316.00
5.5.260.0030.03515.99
5.5.250.0080.04315.94
5.5.240.0100.02715.63
5.5.230.0090.03215.71
5.5.220.0110.02815.80
5.5.210.0050.02715.72
5.5.200.0150.03815.71
5.5.190.0060.02515.70
5.5.180.0080.03215.58
5.5.170.0060.00611.02
5.5.160.0100.04015.49
5.5.150.0060.03515.69
5.5.140.0100.04015.62
5.5.130.0060.04115.78
5.5.120.0050.04315.71
5.5.110.0120.03715.53
5.5.100.0080.04015.58
5.5.90.0080.04015.75
5.5.80.0110.03215.59
5.5.70.0030.04515.71
5.5.60.0000.03615.74
5.5.50.0090.02615.38
5.5.40.0050.02915.74
5.5.30.0140.02215.75
5.5.20.0070.04315.57
5.5.10.0090.02815.59
5.5.00.0070.03015.59
5.4.450.0060.04115.28
5.4.440.0060.04315.46
5.4.430.0050.03015.14
5.4.420.0050.03015.30
5.4.410.0080.04215.44
5.4.400.0080.04214.98
5.4.390.0050.04114.96
5.4.380.0070.04115.09
5.4.370.0050.03414.92
5.4.360.0050.03814.94
5.4.350.0060.04214.98
5.4.340.0060.04215.20
5.4.330.0100.00311.03
5.4.320.0060.02815.16
5.4.310.0080.04015.31
5.4.300.0100.03715.05
5.4.290.0100.02615.04
5.4.280.0060.04115.04
5.4.270.0060.03014.86
5.4.260.0100.03714.90
5.4.250.0090.02715.16
5.4.240.0050.03515.04
5.4.230.0030.03115.08
5.4.220.0070.04214.87
5.4.210.0040.04314.99
5.4.200.0080.02714.82
5.4.190.0120.03514.98
5.4.180.0050.02815.06
5.4.170.0100.03615.05
5.4.160.0020.02515.08
5.4.150.0080.03515.07
5.4.140.0050.03713.62
5.4.130.0090.03613.74
5.4.120.0020.03213.74
5.4.110.0110.02213.67
5.4.100.0060.03413.71
5.4.90.0010.04413.82
5.4.80.0070.03813.84
5.4.70.0050.03013.60
5.4.60.0050.02313.85
5.4.50.0050.03913.82
5.4.40.0120.03513.74
5.4.30.0100.03713.73
5.4.20.0050.03513.78
5.4.10.0060.03013.71
5.4.00.0050.03313.44
5.3.290.0090.02312.59
5.3.280.0080.03812.51
5.3.270.0050.04112.55
5.3.260.0000.02912.59
5.3.250.0030.04512.60
5.3.240.0060.04312.56
5.3.230.0030.04312.53
5.3.220.0040.03212.53
5.3.210.0030.02412.59
5.3.200.0080.04012.59
5.3.190.0070.03912.53
5.3.180.0030.03512.60
5.3.170.0070.02212.54
5.3.160.0030.03912.51
5.3.150.0050.04012.56
5.3.140.0060.03612.51
5.3.130.0070.03212.56
5.3.120.0080.03812.54
5.3.110.0090.03812.59
5.3.100.0030.04112.29
5.3.90.0050.03912.22
5.3.80.0080.03612.27
5.3.70.0050.03712.29
5.3.60.0030.04212.32
5.3.50.0050.03812.18
5.3.40.0060.02412.28
5.3.30.0030.02512.21
5.3.20.0050.04312.11
5.3.10.0050.03112.02
5.3.00.0040.02712.04
5.2.170.0030.02310.78
5.2.160.0010.03310.85
5.2.150.0050.02310.79
5.2.140.0050.03210.87
5.2.130.0050.02810.86
5.2.120.0070.01810.83
5.2.110.0030.03210.79
5.2.100.0040.02910.75
5.2.90.0080.02710.87
5.2.80.0050.03310.83
5.2.70.0090.02110.76
5.2.60.0070.02710.73
5.2.50.0030.03110.80
5.2.40.0030.03510.80
5.2.30.0050.02810.68
5.2.20.0070.02610.73
5.2.10.0050.02210.64
5.2.00.0050.03310.65
5.1.60.0060.01710.25
5.1.50.0030.02310.28
5.1.40.0060.02510.25
5.1.30.0080.02710.35
5.1.20.0050.02810.46
5.1.10.0030.03010.28
5.1.00.0030.03110.29
5.0.50.0050.0139.58
5.0.40.0020.0239.52
5.0.30.0000.0349.37
5.0.20.0030.0259.39
5.0.10.0050.0199.39
5.0.00.0070.0329.33
4.4.90.0050.0178.81
4.4.80.0030.0188.81
4.4.70.0040.0178.81
4.4.60.0050.0168.81
4.4.50.0030.0208.81
4.4.40.0050.0288.81
4.4.30.0000.0218.81
4.4.20.0020.0198.81
4.4.10.0030.0128.81
4.4.00.0020.0288.81
4.3.110.0020.0168.81
4.3.100.0030.0128.81
4.3.90.0020.0178.81
4.3.80.0060.0258.81
4.3.70.0020.0188.81
4.3.60.0000.0188.81
4.3.50.0030.0188.81
4.3.40.0010.0258.81
4.3.30.0030.0138.81
4.3.20.0020.0158.81
4.3.10.0010.0168.81
4.3.00.0030.0128.81

preferences:
52.24 ms | 401 KiB | 5 Q