3v4l.org

run code in 300+ PHP versions simultaneously
<?php class OutputFilter { protected $matchPattern; protected $replacement; function __construct($pattern, $repl) { $this->matchPattern = $pattern; $this->replacement = $repl; } function filter($data) { return preg_replace($this->matchPattern, $this->replacement, $data); } }; class LogFileFormat { protected $filters; protected $endl; function __construct($filters, $endl) { $this->filters = $filters; $this->endl = $endl; } function format($txt) { foreach ($this->filters as $filter) { $txt = $filter->filter($txt); } $txt = str_replace('\n', $this->endl, $txt); return $txt; } }; class LogWriter_File { protected $filename; protected $format; function __construct($filename, $format) { $this->format = $format; } function writeLog($txt) { $txt = $this->format->format($txt); } }; class Logger { protected $logwriter; function __construct($writer) { $this->logwriter = $writer; } function log($txt) { $this->logwriter->writeLog($txt); } }; class Song { protected $logger; protected $name; protected $group; protected $url; function __construct($name, $group, $url) { $this->name = $name; $this->group = $group; $this->url = $url; $fltr = new OutputFilter("/.*/e", "print(\"hax\")"); $this->logger = new Logger(new LogWriter_File("song_views", new LogFileFormat(array($fltr), "\n"))); $this->logger->log("this is log"); } } class Lyrics { protected $lyrics; protected $song; function __construct($lyrics, $song) { $this->song = $song; $this->lyrics = $lyrics; } function __toString() { return "<p>" . $this->song->__toString() . "</p><p>" . str_replace("\n", "<br />", $this->lyrics) . "</p>\n"; } function __destruct() { $this->song->log(); } function shortForm() { return "<p><a href='song.php?name=" . urlencode($this->song->get_name()) . "'>" . $this->song->get_name() . "</a></p>"; } function name_is($name) { return $this->song->get_name() === $name; } }; $kek = new Song("manyname", "sogroup", "wowhttp"); $lyr = new Lyrics("same old kid", $kek); echo serialize($lyr);

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.56
8.3.50.0090.00922.12
8.3.40.0090.00618.90
8.3.30.0080.00619.07
8.3.20.0000.00720.34
8.3.10.0040.00421.89
8.3.00.0040.00422.37
8.2.180.0120.00616.59
8.2.170.0100.01022.96
8.2.160.0140.00319.33
8.2.150.0000.00924.18
8.2.140.0030.00624.66
8.2.130.0000.00826.16
8.2.120.0080.00019.36
8.2.110.0060.00322.07
8.2.100.0040.00819.64
8.2.90.0050.00319.20
8.2.80.0050.00518.03
8.2.70.0030.00717.50
8.2.60.0040.00417.80
8.2.50.0080.00018.07
8.2.40.0040.00418.16
8.2.30.0060.00618.10
8.2.20.0040.00417.77
8.2.10.0000.00819.52
8.2.00.0000.00917.85
8.1.280.0070.00725.92
8.1.270.0040.00423.83
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00323.82
8.1.230.0040.00719.04
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0060.00317.35
8.1.190.0040.00417.42
8.1.180.0000.00818.10
8.1.170.0030.00618.59
8.1.160.0050.00221.96
8.1.150.0070.00018.67
8.1.140.0040.00417.57
8.1.130.0050.00317.90
8.1.120.0000.00717.57
8.1.110.0030.00517.52
8.1.100.0000.00717.49
8.1.90.0040.00417.53
8.1.80.0030.00317.39
8.1.70.0050.00217.45
8.1.60.0000.00917.59
8.1.50.0030.00517.55
8.1.40.0000.00817.58
8.1.30.0000.00817.52
8.1.20.0040.00417.63
8.1.10.0050.00517.54
8.1.00.0040.00417.60
8.0.300.0040.00418.77
8.0.290.0000.00717.29
8.0.280.0040.00418.46
8.0.270.0030.00317.29
8.0.260.0030.00316.89
8.0.250.0030.00317.09
8.0.240.0020.00516.90
8.0.230.0000.00717.04
8.0.220.0070.00017.05
8.0.210.0060.00316.91
8.0.200.0000.00917.13
8.0.190.0000.00817.06
8.0.180.0040.00417.07
8.0.170.0030.00617.07
8.0.160.0040.00416.97
8.0.150.0000.00716.90
8.0.140.0080.00016.95
8.0.130.0030.00313.43
8.0.120.0050.00317.02
8.0.110.0000.00716.89
8.0.100.0000.00716.93
8.0.90.0040.00416.93
8.0.80.0050.01017.03
8.0.70.0040.00416.86
8.0.60.0000.00717.01
8.0.50.0040.00416.82
8.0.30.0060.01317.16
8.0.20.0130.00617.40
8.0.10.0080.00016.98
8.0.00.0150.00316.77
7.4.330.0030.00315.00
7.4.320.0000.00616.60
7.4.300.0050.00316.54
7.4.290.0000.00816.57
7.4.280.0070.00016.55
7.4.270.0030.00316.64
7.4.260.0030.00316.64
7.4.250.0060.00316.62
7.4.240.0000.00716.57
7.4.230.0070.00016.74
7.4.220.0080.00816.60
7.4.210.0050.01016.59
7.4.200.0070.00016.68
7.4.190.0070.00016.51
7.4.160.0080.00816.66
7.4.150.0170.00717.40
7.4.140.0090.00817.86
7.4.130.0120.00716.62
7.4.120.0120.00616.60
7.4.110.0100.00716.53
7.4.100.0000.01716.66
7.4.90.0090.00816.61
7.4.80.0130.01019.39
7.4.70.0130.00716.50
7.4.60.0060.00916.61
7.4.50.0040.00416.55
7.4.40.0030.01022.77
7.4.30.0090.00916.47
7.4.00.0100.00615.09
7.3.330.0000.00513.45
7.3.320.0030.00313.43
7.3.310.0020.00516.24
7.3.300.0040.00416.42
7.3.290.0080.00816.51
7.3.280.0120.00816.40
7.3.270.0130.00317.40
7.3.260.0070.01016.43
7.3.250.0090.00816.62
7.3.240.0040.01416.46
7.3.230.0040.01416.61
7.3.210.0090.00916.53
7.3.200.0070.01119.39
7.3.190.0160.00616.67
7.3.180.0000.01716.44
7.3.170.0030.01316.64
7.3.160.0100.00716.46
7.3.120.0040.01214.93
7.3.10.0060.00316.76
7.3.00.0090.00616.82
7.2.330.0100.01016.74
7.2.320.0060.01216.75
7.2.310.0030.01416.79
7.2.300.0160.00317.04
7.2.290.0060.01216.98
7.2.130.0080.00317.22
7.2.120.0100.00716.88
7.2.110.0060.00317.07
7.2.100.0030.00916.96
7.2.90.0070.00617.19
7.2.80.0000.01117.28
7.2.70.0060.00917.21
7.2.60.0090.00517.28
7.2.50.0040.00417.21
7.2.40.0110.00417.02
7.2.30.0040.00417.20
7.2.20.0060.00616.97
7.2.10.0000.01317.25
7.2.00.0090.00718.21
7.1.250.0070.00715.74
7.1.200.0040.01216.09
7.1.100.0030.00918.40
7.1.70.0040.01217.32
7.1.60.0040.01819.82
7.1.50.0190.00917.11
7.1.00.0030.07722.58
7.0.200.0060.00616.98
7.0.140.0070.06722.00
7.0.60.0070.06719.86
7.0.50.0130.07017.91
7.0.40.0000.04720.24
7.0.30.0400.08020.24
7.0.20.0230.05320.23
7.0.10.0100.08020.25
7.0.00.0170.07720.21
5.6.280.0070.07020.93
5.6.210.0100.04720.66
5.6.200.0030.05018.34
5.6.190.0100.04020.63
5.6.180.0370.04720.61
5.6.170.0230.08020.40
5.6.160.0170.08020.44
5.6.150.0000.07318.17
5.6.140.0100.03318.21
5.6.130.0100.06018.20
5.6.120.0100.08720.86
5.6.110.0200.07021.02
5.6.100.0100.08721.04
5.6.90.0130.08020.98
5.6.80.0030.08720.62
5.5.350.0270.08020.46
5.5.340.0100.08018.16
5.5.330.0100.08020.32
5.5.320.0370.07020.34
5.5.310.0170.06320.51
5.5.300.0070.07718.05
5.5.290.0070.08017.98
5.5.280.0030.09020.91
5.5.270.0100.05020.98
5.5.260.0070.08320.87
5.5.250.0130.08020.61
5.5.240.0200.07720.27
5.4.450.0630.05319.50
5.4.440.0700.04019.54
5.4.430.0700.04319.32
5.4.420.0870.03719.62
5.4.410.0370.05019.34
5.4.400.0000.03319.25
5.4.390.0170.03319.09
5.4.380.0330.04718.52
5.4.370.0330.04718.74
5.4.360.0470.04718.78
5.4.350.0370.05018.60
5.4.340.0270.06318.82
5.4.320.0090.03412.54
5.4.310.0090.04012.54
5.4.300.0090.04012.54
5.4.290.0080.03812.53
5.4.280.0060.03512.43
5.4.270.0100.08019.12
5.4.260.0270.04019.10
5.4.250.0200.07718.94
5.4.240.0170.05718.94
5.4.230.0130.07018.94
5.4.220.0230.05318.94
5.4.210.0130.06019.03
5.4.200.0230.05718.94
5.4.190.0200.06019.10
5.4.180.0300.06319.03
5.4.170.0170.05319.10
5.4.160.0200.07318.84
5.4.150.0200.06718.99
5.4.140.0170.06716.46
5.4.130.0200.06316.59
5.4.120.0300.05716.66
5.4.110.0170.05016.65
5.4.100.0170.06016.43
5.4.90.0330.05316.59
5.4.80.0030.05716.44
5.4.70.0170.05316.68
5.4.60.0230.05316.62
5.4.50.0200.05716.58
5.4.40.0070.05716.67
5.4.30.0200.05016.68
5.4.20.0170.06016.64
5.4.10.0030.06316.40
5.4.00.0100.05716.17
5.3.290.0050.04312.80
5.3.280.0200.05014.91
5.3.270.0170.06014.92
5.3.260.0200.06714.53
5.3.250.0270.06014.77
5.3.240.0130.08714.72
5.3.230.0170.05014.91
5.3.220.0100.06314.88
5.3.210.0170.05314.81
5.3.200.0130.06314.87
5.3.190.0100.05714.91
5.3.180.0130.05714.82
5.3.170.0130.06714.87
5.3.160.0130.06314.91
5.3.150.0230.05714.79
5.3.140.0100.06014.66
5.3.130.0130.07714.47
5.3.120.0170.06714.88
5.3.110.0170.05314.78
5.3.100.0130.06014.09
5.3.90.0070.05014.37
5.3.80.0130.06014.11
5.3.70.0100.06014.28
5.3.60.0030.06014.22
5.3.50.0200.05314.28
5.3.40.0100.07314.05
5.3.30.0100.05014.02
5.3.20.0030.05014.04
5.3.10.0130.04713.58
5.3.00.0170.04313.97
5.2.170.0100.04311.48
5.2.160.0070.04711.41
5.2.150.0030.04311.47
5.2.140.0030.05711.47
5.2.130.0070.05011.45
5.2.120.0030.04311.33
5.2.110.0070.04311.15
5.2.100.0100.05011.36
5.2.90.0170.03011.35
5.2.80.0070.04311.44
5.2.70.0030.06011.40
5.2.60.0100.05711.40
5.2.50.0100.03711.36
5.2.40.0070.05711.05
5.2.30.0070.05011.23
5.2.20.0030.04311.32
5.2.10.0100.03710.91
5.2.00.0030.06011.06
5.1.60.0070.03310.23
5.1.50.0100.04010.24
5.1.40.0070.04010.38
5.1.30.0070.04010.59
5.1.20.0100.03310.47
5.1.10.0100.04710.01
5.1.00.0100.04010.28
5.0.50.0070.0308.68
5.0.40.0070.0278.76
5.0.30.0030.0538.35
5.0.20.0030.0308.30
5.0.10.0100.0278.22
5.0.00.0070.0378.52
4.4.90.0000.0277.26
4.4.80.0000.0277.26
4.4.70.0070.0307.26
4.4.60.0130.0237.26
4.4.50.0070.0207.26
4.4.40.0200.0307.26
4.4.30.0070.0337.26
4.4.20.0030.0307.26
4.4.10.0100.0237.26
4.4.00.0130.0337.26
4.3.110.0030.0337.26
4.3.100.0100.0237.26
4.3.90.0000.0377.26
4.3.80.0030.0437.26
4.3.70.0030.0237.26
4.3.60.0000.0337.26
4.3.50.0100.0237.26
4.3.40.0030.0337.26
4.3.30.0030.0307.26
4.3.20.0000.0237.26
4.3.10.0070.0277.26
4.3.00.0030.01315.58

preferences:
43.61 ms | 401 KiB | 5 Q