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); $uus = array($lyr); echo serialize($uus);

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.0070.00716.75
8.3.60.0140.00018.43
8.3.50.0100.00721.98
8.3.40.0110.00718.78
8.3.30.0090.00619.01
8.3.20.0000.00820.22
8.3.10.0080.00022.09
8.3.00.0000.00822.32
8.2.180.0070.01116.88
8.2.170.0070.01422.96
8.2.160.0120.00319.25
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0030.00617.63
8.2.110.0030.00722.00
8.2.100.0040.00719.57
8.2.90.0040.00419.22
8.2.80.0030.00617.97
8.2.70.0080.00017.63
8.2.60.0090.00017.80
8.2.50.0050.00318.07
8.2.40.0060.00318.16
8.2.30.0040.00818.17
8.2.20.0040.00417.92
8.2.10.0040.00419.52
8.2.00.0040.00417.71
8.1.280.0100.00725.92
8.1.270.0070.00722.28
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0060.00323.86
8.1.230.0100.00019.15
8.1.220.0000.00817.79
8.1.210.0080.00018.77
8.1.200.0040.00717.35
8.1.190.0000.00817.40
8.1.180.0060.00318.10
8.1.170.0030.00618.50
8.1.160.0050.00222.03
8.1.150.0000.00718.57
8.1.140.0000.01017.50
8.1.130.0040.00417.94
8.1.120.0040.00417.46
8.1.110.0070.00017.52
8.1.100.0000.00717.41
8.1.90.0050.00217.51
8.1.80.0040.00417.46
8.1.70.0030.00517.50
8.1.60.0000.00917.62
8.1.50.0040.00417.57
8.1.40.0040.00417.60
8.1.30.0050.00217.67
8.1.20.0040.00417.62
8.1.10.0040.00417.52
8.1.00.0060.00317.42
8.0.300.0000.00818.77
8.0.290.0070.00017.18
8.0.280.0030.00518.55
8.0.270.0000.00717.36
8.0.260.0000.00716.84
8.0.250.0040.00417.04
8.0.240.0030.00316.99
8.0.230.0050.00317.08
8.0.220.0030.00517.11
8.0.210.0060.00317.00
8.0.200.0050.00217.03
8.0.190.0000.00716.96
8.0.180.0040.00416.88
8.0.170.0000.00916.97
8.0.160.0040.00416.89
8.0.150.0000.00816.88
8.0.140.0060.00316.98
8.0.130.0060.00013.39
8.0.120.0000.00816.96
8.0.110.0000.00717.06
8.0.100.0050.00317.01
8.0.90.0040.00417.04
8.0.80.0060.00917.00
8.0.70.0000.00716.96
8.0.60.0000.00716.84
8.0.50.0040.00417.00
8.0.30.0150.00717.06
8.0.20.0100.00817.40
8.0.10.0000.00716.96
8.0.00.0110.00816.67
7.4.330.0030.00315.03
7.4.320.0030.00316.58
7.4.300.0040.00416.61
7.4.290.0000.00816.66
7.4.280.0000.00716.54
7.4.270.0030.00316.49
7.4.260.0040.00716.67
7.4.250.0040.00416.59
7.4.240.0040.00416.61
7.4.230.0030.00316.61
7.4.220.0070.01116.59
7.4.210.0070.00816.70
7.4.200.0070.00016.35
7.4.190.0040.00416.80
7.4.160.0090.00616.39
7.4.150.0130.01317.40
7.4.140.0110.00617.86
7.4.130.0120.00716.60
7.4.120.0070.01016.66
7.4.110.0130.01016.50
7.4.100.0100.01316.43
7.4.90.0100.00716.68
7.4.80.0120.00619.39
7.4.70.0070.01016.67
7.4.60.0070.01016.44
7.4.50.0030.00316.64
7.4.40.0060.00922.77
7.4.30.0070.01016.64
7.4.10.0130.00616.61
7.4.00.0060.00815.93
7.3.330.0050.00013.29
7.3.320.0050.00013.24
7.3.310.0030.00316.24
7.3.300.0040.00416.43
7.3.290.0090.00616.55
7.3.280.0090.00716.41
7.3.270.0030.01517.40
7.3.260.0100.00716.59
7.3.250.0120.00516.53
7.3.240.0090.00916.51
7.3.230.0000.01616.61
7.3.210.0030.01416.54
7.3.200.0090.00819.39
7.3.190.0090.01216.47
7.3.180.0060.01216.48
7.3.170.0120.00416.43
7.3.160.0090.01316.59
7.3.130.0030.01316.27
7.3.120.0100.00515.65
7.3.110.0070.00716.20
7.3.100.0040.00816.50
7.3.90.0040.00716.38
7.3.80.0030.00516.68
7.3.70.0040.00716.29
7.3.60.0090.00016.31
7.3.50.0090.00016.17
7.3.40.0070.00416.57
7.3.30.0100.00616.43
7.3.20.0030.01018.26
7.3.10.0060.00717.97
7.3.00.0070.00718.24
7.2.330.0090.00917.01
7.2.320.0100.01317.02
7.2.310.0110.00616.93
7.2.300.0100.00716.93
7.2.290.0090.00916.89
7.2.260.0000.01816.63
7.2.250.0070.01316.60
7.2.240.0060.00916.72
7.2.230.0000.01517.03
7.2.220.0040.00416.84
7.2.210.0050.00816.88
7.2.200.0040.00716.75
7.2.190.0040.01116.65
7.2.180.0030.01016.89
7.2.170.0060.00616.77
7.2.160.0080.00816.62
7.2.150.0070.00718.52
7.2.140.0040.01118.64
7.2.130.0070.01018.68
7.2.120.0080.00318.58
7.2.110.0070.00318.65
7.2.100.0120.00618.83
7.2.90.0090.00618.66
7.2.80.0120.00318.49
7.2.70.0060.00618.54
7.2.60.0080.00617.82
7.2.50.0110.00318.55
7.2.40.0090.00318.68
7.2.30.0000.01618.63
7.2.20.0030.01018.61
7.2.10.0030.01218.66
7.2.00.0090.00719.25
7.1.330.0030.01217.46
7.1.320.0070.00417.45
7.1.310.0090.00917.37
7.1.300.0080.00817.37
7.1.290.0090.00617.53
7.1.280.0120.00917.44
7.1.270.0130.01015.75
7.1.260.0000.00817.73
7.1.250.0070.00717.37
7.1.240.0030.00917.52
7.1.230.0000.01317.44
7.1.220.0090.00617.52
7.1.210.0000.01117.45
7.1.200.0080.00516.83
7.1.190.0000.01117.36
7.1.180.0090.00617.60
7.1.170.0030.00917.50
7.1.160.0030.00517.50
7.1.150.0070.00217.53
7.1.140.0040.01217.34
7.1.130.0030.00617.42
7.1.120.0040.01117.32
7.1.110.0030.01317.47
7.1.100.0050.00917.82
7.1.90.0090.00617.52
7.1.80.0080.00817.66
7.1.70.0100.00717.54
7.1.60.0070.01318.59
7.1.50.0070.01017.39
7.1.40.0040.01217.34
7.1.30.0000.01117.34
7.1.20.0090.00917.61
7.1.10.0030.01417.42
7.1.00.0060.03719.95
7.0.330.0030.01317.02
7.0.320.0120.00417.16
7.0.310.0040.01117.10
7.0.300.0070.00417.13
7.0.290.0070.00317.15
7.0.280.0040.00817.18
7.0.270.0070.00317.07
7.0.260.0030.00917.19
7.0.250.0070.00717.39
7.0.240.0040.01117.17
7.0.230.0140.00017.06
7.0.220.0060.00617.33
7.0.210.0070.00717.29
7.0.200.0050.00917.06
7.0.190.0120.00017.19
7.0.180.0030.01017.27
7.0.170.0090.00317.16
7.0.160.0000.01317.20
7.0.150.0030.01317.08
7.0.140.0070.03719.71
7.0.130.0070.01017.18
7.0.120.0030.01417.13
7.0.110.0000.01717.11
7.0.100.0090.00917.13
7.0.90.0040.01317.34
7.0.80.0000.01217.07
7.0.70.0070.00717.04
7.0.60.0090.03918.56
7.0.50.0050.04617.45
7.0.40.0070.03917.68
7.0.30.0180.02817.58
7.0.20.0130.03317.66
7.0.10.0120.03417.57
7.0.00.0060.02817.74
5.6.400.0100.00716.34
5.6.390.0030.00715.70
5.6.380.0080.00416.25
5.6.370.0040.00816.19
5.6.360.0060.00616.09
5.6.350.0050.00516.32
5.6.340.0070.01116.29
5.6.330.0060.00315.95
5.6.320.0090.00315.99
5.6.310.0070.00515.98
5.6.300.0030.01316.04
5.6.290.0030.01215.72
5.6.280.0050.04018.66
5.6.270.0090.00916.07
5.6.260.0060.01016.00
5.6.250.0070.00716.08
5.6.240.0090.00315.81
5.6.230.0080.00315.96
5.6.220.0060.01015.93
5.6.210.0140.02018.38
5.6.200.0030.03417.14
5.6.190.0070.02718.22
5.6.180.2120.02518.21
5.6.170.0140.04218.30
5.6.160.0070.02718.15
5.6.150.0100.04117.10
5.6.140.0050.02917.15
5.6.130.0040.04617.26
5.6.120.0090.02018.66
5.6.110.0030.03518.48
5.6.100.0100.03518.47
5.6.90.0070.04018.41
5.6.80.0000.02918.17
5.6.70.0220.03418.36
5.6.60.0040.00415.80
5.6.50.0060.00715.94
5.6.40.0000.01315.89
5.6.30.0100.00315.86
5.6.20.0070.00715.90
5.6.10.0000.01115.89
5.6.00.0070.01015.82
5.5.380.0000.01215.64
5.5.370.0050.01415.96
5.5.360.0060.00615.78
5.5.350.0050.04518.19
5.5.340.0050.04317.03
5.5.330.0050.03517.95
5.5.320.0160.02518.11
5.5.310.0130.03818.07
5.5.300.0080.04516.93
5.5.290.0030.02316.93
5.5.280.0110.03618.35
5.5.270.0080.02518.45
5.5.260.0080.02518.41
5.5.250.0050.04918.23
5.5.240.0070.04518.05
5.5.230.0030.00815.66
5.5.220.0000.01615.73
5.5.210.0040.00915.71
5.5.200.0070.00715.66
5.5.190.0060.00915.75
5.5.180.0070.01015.66
5.5.170.0070.00716.04
5.5.160.0070.00715.98
5.5.150.0150.00416.02
5.5.140.0080.00815.90
5.5.130.0100.00315.59
5.5.120.0040.00815.86
5.5.110.0040.01116.01
5.5.100.0080.00315.86
5.5.90.0030.01315.89
5.5.80.0040.00715.82
5.5.70.0140.00715.69
5.5.60.0000.01415.72
5.5.50.0100.00715.85
5.5.40.0120.00616.04
5.5.30.0120.00315.84
5.5.20.0100.01015.91
5.5.10.0100.00715.95
5.5.00.0090.00615.76
5.4.450.0440.04016.20
5.4.440.0320.04016.05
5.4.430.0120.02516.14
5.4.420.0060.03116.22
5.4.410.0060.03615.96
5.4.400.0070.03215.74
5.4.390.0050.03115.66
5.4.380.0210.03315.78
5.4.370.0130.03315.80
5.4.360.0090.03215.73
5.4.350.0120.02915.63
5.4.340.0090.03315.62
5.4.330.0000.00912.86
5.4.320.0070.02112.64
5.4.310.0060.02212.56
5.4.300.0070.02712.51
5.4.290.0040.02412.51
5.4.280.0050.02712.58
5.4.270.0030.03615.79
5.4.260.0050.03515.68
5.4.250.0070.04015.96
5.4.240.0100.03315.65
5.4.230.0070.04115.76
5.4.220.0110.02515.80
5.4.210.0120.02715.76
5.4.200.0070.03415.75
5.4.190.0120.03215.94
5.4.180.0070.04115.88
5.4.170.0080.03915.79
5.4.160.0100.03115.81
5.4.150.0070.03815.87
5.4.140.0060.03314.53
5.4.130.0030.04014.63
5.4.120.0030.03614.55
5.4.110.0050.03814.60
5.4.100.0050.03014.77
5.4.90.0080.03314.66
5.4.80.0030.03314.50
5.4.70.0030.04114.63
5.4.60.0070.03614.69
5.4.50.0120.03514.71
5.4.40.0080.03514.68
5.4.30.0050.03614.61
5.4.20.0030.03514.41
5.4.10.0090.03914.53
5.4.00.0040.03414.43
5.3.290.0050.02712.97
5.3.280.0140.03213.99
5.3.270.0070.02914.07
5.3.260.0120.03714.00
5.3.250.0030.03514.06
5.3.240.0050.04613.99
5.3.230.0050.03614.05
5.3.220.0050.03513.85
5.3.210.0060.03514.08
5.3.200.0050.03613.93
5.3.190.0090.03413.92
5.3.180.0070.03814.04
5.3.170.0100.03214.12
5.3.160.0070.04014.05
5.3.150.0060.03513.85
5.3.140.0060.02814.03
5.3.130.0080.03613.81
5.3.120.0050.03313.91
5.3.110.0030.04213.95
5.3.100.0080.03613.71
5.3.90.0070.04213.76
5.3.80.0130.03213.67
5.3.70.0100.03513.59
5.3.60.0050.03713.58
5.3.50.0110.03313.62
5.3.40.0060.03313.67
5.3.30.0040.02813.60
5.3.20.0110.03013.63
5.3.10.0100.03113.31
5.3.00.0090.02813.38
5.2.170.0070.05311.26
5.2.160.0030.06011.19
5.2.150.0100.04711.10
5.2.140.0130.03711.21
5.2.130.0130.05011.45
5.2.120.0130.05011.45
5.2.110.0170.04711.35
5.2.100.0100.04311.21
5.2.90.0030.05711.13
5.2.80.0070.06311.35
5.2.70.0070.06011.36
5.2.60.0100.05011.39
5.2.50.0030.04711.28
5.2.40.0000.05711.05
5.2.30.0070.06311.31
5.2.20.0130.05011.01
5.2.10.0100.04711.17
5.2.00.0070.05710.82
5.1.60.0100.03010.24
5.1.50.0030.04010.24
5.1.40.0170.03710.32
5.1.30.0100.05010.27
5.1.20.0130.03710.59
5.1.10.0030.05710.12
5.1.00.0100.03310.29
5.0.50.0030.0408.83
5.0.40.0070.0308.57
5.0.30.0000.0478.28
5.0.20.0000.0338.46
5.0.10.0030.0438.46
5.0.00.0000.0608.43
4.4.90.0030.0277.10
4.4.80.0070.0277.10
4.4.70.0130.0207.10
4.4.60.0070.0277.10
4.4.50.0030.0277.10
4.4.40.0100.0377.10
4.4.30.0100.0207.10
4.4.20.0070.0407.10
4.4.10.0030.0337.10
4.4.00.0000.0507.10
4.3.110.0000.0277.26
4.3.100.0030.0207.26
4.3.90.0000.0337.26
4.3.80.0030.0377.26
4.3.70.0030.0237.26
4.3.60.0030.0207.26
4.3.50.0030.0277.26
4.3.40.0030.0337.26
4.3.30.0000.0307.26
4.3.20.0000.0277.26
4.3.10.0030.0237.26
4.3.00.0100.0237.38

preferences:
40.82 ms | 401 KiB | 5 Q