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 json_encode(serialize(new Post(new SplFileObject("/home/daedalus/flag.txt"), "br", [new Filter("/gibe/", "gibe moni"), new Filter("/moni/", "i repor u")])));

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.0080.00618.68
8.3.50.0080.01222.02
8.3.40.0150.00018.88
8.3.30.0090.00619.31
8.3.20.0000.00820.16
8.3.10.0080.00023.64
8.3.00.0050.00319.50
8.2.180.0150.00018.34
8.2.170.0100.01022.96
8.2.160.0080.00620.39
8.2.150.0060.00324.18
8.2.140.0060.00324.66
8.2.130.0050.00326.16
8.2.120.0020.00522.18
8.2.110.0090.00922.25
8.2.100.0130.00017.63
8.2.90.0040.00419.21
8.2.80.0040.00417.97
8.2.70.0040.00417.75
8.2.60.0090.00018.03
8.2.50.0050.00318.07
8.2.40.0030.00619.88
8.2.30.0040.00418.18
8.2.20.0030.00517.70
8.2.10.0050.00318.18
8.2.00.0040.00417.85
8.1.280.0070.01425.92
8.1.270.0000.00823.88
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0060.00323.98
8.1.230.0050.00519.13
8.1.220.0000.00917.74
8.1.210.0000.00818.77
8.1.200.0060.00317.47
8.1.190.0030.00617.48
8.1.180.0040.00418.10
8.1.170.0030.00518.71
8.1.160.0050.00222.12
8.1.150.0000.00718.96
8.1.140.0000.00717.48
8.1.130.0000.00717.86
8.1.120.0000.00717.50
8.1.110.0040.00417.46
8.1.100.0080.00017.57
8.1.90.0000.00717.43
8.1.80.0040.00417.61
8.1.70.0030.00317.42
8.1.60.0030.00617.62
8.1.50.0050.00317.56
8.1.40.0040.00417.50
8.1.30.0000.00817.63
8.1.20.0040.00417.77
8.1.10.0040.00417.52
8.1.00.0000.00817.61
8.0.300.0000.00718.77
8.0.290.0070.00016.88
8.0.280.0000.00718.51
8.0.270.0040.00417.20
8.0.260.0030.00317.35
8.0.250.0070.00016.98
8.0.240.0030.00316.98
8.0.230.0030.00717.08
8.0.220.0000.00817.07
8.0.210.0000.00817.07
8.0.200.0040.00417.10
8.0.190.0040.00417.05
8.0.180.0050.00217.02
8.0.170.0040.00416.95
8.0.160.0000.00717.11
8.0.150.0050.00217.00
8.0.140.0040.00416.98
8.0.130.0000.00613.42
8.0.120.0030.00516.88
8.0.110.0030.00517.06
8.0.100.0040.00417.05
8.0.90.0020.00516.92
8.0.80.0100.01017.06
8.0.70.0040.00416.85
8.0.60.0070.00016.90
8.0.50.0050.00217.07
8.0.30.0090.01116.99
8.0.20.0140.00817.40
8.0.10.0000.00817.14
8.0.00.0060.01316.73
7.4.330.0050.00015.02
7.4.320.0000.00616.59
7.4.300.0070.00016.68
7.4.290.0070.00016.73
7.4.280.0100.00416.71
7.4.270.0000.00716.44
7.4.260.0030.00316.61
7.4.250.0030.00316.68
7.4.240.0000.00816.66
7.4.230.0000.00816.67
7.4.220.0090.00916.70
7.4.210.0060.00916.61
7.4.200.0070.00016.61
7.4.160.0040.01216.59
7.4.150.0070.01017.40
7.4.140.0110.00717.86
7.4.130.0080.00916.62
7.4.120.0100.00716.63
7.4.110.0040.01416.55
7.4.100.0120.00816.69
7.4.90.0140.00316.65
7.4.80.0120.00819.39
7.4.70.0110.00816.70
7.4.60.0070.01016.54
7.4.50.0000.00716.53
7.4.40.0140.00316.68
7.4.30.0100.01016.61
7.4.00.0100.00314.98
7.3.330.0000.00613.24
7.3.320.0050.00013.36
7.3.310.0030.00316.34
7.3.300.0030.00316.46
7.3.290.0120.00416.37
7.3.280.0110.00616.42
7.3.270.0070.01017.40
7.3.260.0100.01016.47
7.3.250.0130.00416.61
7.3.240.0070.01116.59
7.3.230.0070.01116.40
7.3.210.0030.01216.49
7.3.200.0170.00319.39
7.3.190.0080.01216.55
7.3.180.0100.01316.47
7.3.170.0100.00616.61
7.3.160.0090.00616.46
7.3.120.0000.01514.97
7.3.110.0000.01114.57
7.3.100.0070.01114.79
7.3.90.0030.01014.71
7.3.80.0130.00014.96
7.3.70.0130.00314.94
7.3.60.0100.00314.65
7.3.50.0070.01014.83
7.3.40.0000.01114.93
7.3.30.0060.01114.73
7.3.20.0080.00816.71
7.3.10.0070.01116.63
7.3.00.0040.01116.67
7.2.330.0030.01516.45
7.2.320.0160.01016.50
7.2.310.0100.01016.79
7.2.300.0060.01216.71
7.2.290.0060.01416.82
7.2.240.0100.00714.77
7.2.230.0110.00715.03
7.2.220.0060.00915.21
7.2.210.0070.00715.14
7.2.200.0080.00814.99
7.2.190.0060.00614.98
7.2.180.0070.00414.98
7.2.170.0070.01015.09
7.2.160.0000.01615.11
7.2.150.0080.00416.84
7.2.140.0100.00717.00
7.2.130.0060.00616.79
7.2.120.0000.01416.74
7.2.110.0060.00916.80
7.2.100.0040.01416.82
7.2.90.0100.00616.93
7.2.80.0070.01116.89
7.2.70.0070.01016.93
7.2.60.0060.00816.67
7.2.50.0130.00316.77
7.2.40.0060.00916.59
7.2.30.0130.00316.77
7.2.20.0030.00916.85
7.2.10.0130.00316.69
7.2.00.0020.01318.01
7.1.330.0070.00315.59
7.1.320.0100.00715.90
7.1.310.0120.00615.72
7.1.300.0030.01315.83
7.1.290.0060.00915.71
7.1.280.0030.01015.71
7.1.270.0030.01315.81
7.1.260.0120.00615.54
7.1.250.0060.00815.60
7.1.200.0100.00315.62
7.1.100.0030.01218.21
7.1.70.0210.00917.10
7.1.60.0110.01419.11
7.1.50.0090.01217.03
7.1.00.0000.08022.48
7.0.200.0000.00916.83
7.0.140.0030.07021.98
7.0.90.0330.05020.09
7.0.80.0400.06020.19
7.0.70.0570.08320.04
7.0.60.0670.08020.01
7.0.50.0530.07020.27
7.0.40.0070.07320.15
7.0.30.0100.07020.05
7.0.20.0070.05320.18
7.0.10.0030.05720.14
7.0.00.0100.08720.08
5.6.280.0030.07021.11
5.6.240.0030.05320.66
5.6.230.0170.06020.69
5.6.220.0030.07320.69
5.6.210.0170.07020.58
5.6.200.0030.08721.07
5.6.190.0030.09320.96
5.6.180.0000.04721.18
5.6.170.0030.09320.95
5.6.160.0170.07321.02
5.6.150.0070.08321.19
5.6.140.0100.03721.03
5.6.130.0130.08721.13
5.6.120.0070.04720.98
5.6.110.0070.05021.02
5.6.100.0070.08721.18
5.6.90.0000.06321.13
5.6.80.0130.07320.44
5.6.70.0070.08320.42
5.6.60.0130.07020.55
5.6.50.0130.07020.45
5.6.40.0030.05020.31
5.6.30.0030.07720.43
5.6.20.0070.07320.48
5.6.10.0030.05320.54
5.6.00.0030.07020.37
5.5.380.0070.07720.36
5.5.370.0130.07720.34
5.5.360.0070.07720.50
5.5.350.0100.05320.40
5.5.340.0100.07720.95
5.5.330.0130.06720.95
5.5.320.0100.08020.87
5.5.310.0130.07020.75
5.5.300.0070.04020.88
5.5.290.0030.05020.75
5.5.280.0030.08320.90
5.5.270.0070.07720.81
5.5.260.0030.05320.90
5.5.250.0030.06320.64
5.5.240.0070.05020.30
5.5.230.0030.08020.19
5.5.220.0200.06320.22
5.5.210.0000.08720.27
5.5.200.0100.05320.27
5.5.190.0030.08020.29
5.5.180.0170.07320.28
5.5.160.0170.06719.97
5.5.150.0130.07020.14
5.5.140.0030.08320.01
5.5.130.0100.06720.21
5.5.120.0000.05720.26
5.5.110.0070.07020.22
5.5.100.0100.07319.97
5.5.90.0100.05320.13
5.5.80.0070.07320.08
5.5.70.0170.07019.96
5.5.60.0070.07720.07
5.5.50.0030.04719.91
5.5.40.0130.06720.07
5.5.30.0100.07020.08
5.5.20.0230.05720.16
5.5.10.0100.08020.10
5.5.00.0000.07720.01
5.4.450.0030.07019.37
5.4.440.0030.04719.46
5.4.430.0130.07319.21
5.4.420.0030.08019.35
5.4.410.0070.07719.05
5.4.400.0130.07019.16
5.4.390.0070.08019.04
5.4.380.0100.07319.05
5.4.370.0070.06719.21
5.4.360.0100.07319.16
5.4.350.0070.05719.18
5.4.340.0030.08019.05
5.4.320.0070.04019.04
5.4.310.0200.07019.04
5.4.300.0070.05318.89
5.4.290.0030.08019.04
5.4.280.0070.05318.84
5.4.270.0100.04318.87
5.4.260.0130.07019.23
5.4.250.0070.04319.04
5.4.240.0100.07719.21
5.4.230.0070.04319.17
5.4.220.0030.07718.87
5.4.210.0000.06719.17
5.4.200.0130.06719.17
5.4.190.0070.07319.02
5.4.180.0100.04319.04
5.4.170.0070.06019.11
5.4.160.0200.04019.19
5.4.150.0070.06018.93
5.4.140.0130.06016.50
5.4.130.0130.06716.40
5.4.120.0100.06716.46
5.4.110.0130.06716.56
5.4.100.0030.07716.56
5.4.90.0070.07016.55
5.4.80.0100.06316.43
5.4.70.0070.06316.50
5.4.60.0130.05716.41
5.4.50.0070.07016.44
5.4.40.0070.07016.45
5.4.30.0070.06716.48
5.4.20.0070.05016.48
5.4.10.0070.07316.36
5.4.00.0030.07315.73
5.3.290.0070.08014.68
5.3.280.0130.06714.75
5.3.270.0070.04314.61
5.3.260.0070.06714.64
5.3.250.0030.08314.76
5.3.240.0030.06014.63
5.3.230.0170.06014.56
5.3.220.0070.07014.50
5.3.210.0000.05014.70
5.3.200.0070.07714.60
5.3.190.0070.06714.54
5.3.180.0130.07014.50
5.3.170.0030.08014.55
5.3.160.0030.07714.57
5.3.150.0070.05314.59
5.3.140.0000.05714.63
5.3.130.0130.07014.49
5.3.120.0000.08014.48
5.3.110.0170.07014.66
5.3.100.0100.07314.07
5.3.90.0100.05014.16
5.3.80.0070.06714.13
5.3.70.0030.06314.01
5.3.60.0070.06014.04
5.3.50.0070.07313.97
5.3.40.0070.05314.11
5.3.30.0070.07014.00
5.3.20.0030.07713.59
5.3.10.0030.07013.76
5.3.00.0070.06313.54
5.2.170.0070.04311.30
5.2.160.0030.06311.25
5.2.150.0000.06711.22
5.2.140.0030.03711.20
5.2.130.0000.07011.03
5.2.120.0000.04711.26
5.2.110.0030.06010.98
5.2.100.0000.04311.22
5.2.90.0030.06011.13
5.2.80.0100.06011.04
5.2.70.0030.04711.23
5.2.60.0000.03710.99
5.2.50.0030.03711.07
5.2.40.0000.04311.09
5.2.30.0070.02710.97
5.2.20.0070.04011.00
5.2.10.0030.04711.02
5.2.00.0000.06710.66
5.1.60.0000.05710.07
5.1.50.0030.04310.00
5.1.40.0070.05010.11
5.1.30.0100.04710.31
5.1.20.0070.05310.30
5.1.10.0070.04310.20
5.1.00.0100.04710.13
5.0.50.0070.0408.57
5.0.40.0000.0478.32
5.0.30.0000.0678.14
5.0.20.0030.0308.32
5.0.10.0070.0378.18
5.0.00.0030.0638.29
4.4.90.0030.0207.43
4.4.80.0070.0107.43
4.4.70.0100.0277.43
4.4.60.0000.0407.43
4.4.50.0000.0377.43
4.4.40.0000.0537.43
4.4.30.0000.0377.43
4.4.20.0070.0337.43
4.4.10.0130.0237.43
4.4.00.0030.0537.43
4.3.110.0000.0377.43
4.3.100.0100.0237.43
4.3.90.0000.0377.43
4.3.80.0030.0537.43
4.3.70.0000.0337.43
4.3.60.0030.0307.43
4.3.50.0070.0237.43
4.3.40.0100.0477.43
4.3.30.0030.0337.43
4.3.20.0000.0377.43
4.3.10.0000.0377.43
4.3.00.0030.0407.43

preferences:
37.03 ms | 401 KiB | 5 Q