3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Logger { public function log($data) { // Actually log your data echo 'LOGGING DATA: ' . $data . PHP_EOL; } } class Hassan { public function multipleByTwo($i) { // Doing business logic $i = (int)$i * 2; return $i; } } class HassanLoggerDecorator { protected $hassan; protected $logger; public function __construct(Hassan $hassan, Logger $logger) { $this->hassan = $hassan; $this->logger = $logger; } public function __call($method, $args) { $this->logger->log(sprintf("Calling method: %s with args: %s", $method, print_r($args, true))); $result = call_user_func_array( array($this->logger, $method), $args ); $this->logger->log(sprintf("Got result: %s", $result)); return $result; } } // Now you can use your Hassan object without logging... $hassan = new Hassan; echo "3 multipled by two is: " . $hassan->multiplyByTwo(3) . PHP_EOL; // Now let's log the output of Hassan, without having it as a dependency!! (Never FORCE logging in anything you do, it's ALWAYS optional) $hassanWithLoggingFunctionality = new HassanLoggerDecorator($hassan, new Logger); echo $hassanWithLoggingFunctionality->multiplyByTwo(3);

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.0140.00018.43
8.3.50.0060.01222.77
8.3.40.0060.00918.73
8.3.30.0100.00319.18
8.3.20.0050.00320.33
8.3.10.0050.00321.93
8.3.00.0000.00818.04
8.2.180.0060.01216.75
8.2.170.0000.01622.96
8.2.160.0070.00720.22
8.2.150.0090.00024.18
8.2.140.0080.00024.66
8.2.130.0070.00726.16
8.2.120.0050.00321.00
8.2.110.0070.01419.13
8.2.100.0140.00717.76
8.2.90.0000.00819.14
8.2.80.0030.00517.97
8.2.70.0060.00317.38
8.2.60.0060.00317.80
8.2.50.0000.00818.07
8.2.40.0030.00517.80
8.2.30.0040.00418.00
8.2.20.0060.00317.70
8.2.10.0040.00418.00
8.2.00.0040.00417.62
8.1.280.0140.00725.92
8.1.270.0060.00323.96
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0090.00022.05
8.1.230.0040.01218.76
8.1.220.0050.00317.74
8.1.210.0050.00318.77
8.1.200.0000.00917.35
8.1.190.0080.00017.11
8.1.180.0030.00518.10
8.1.170.0040.00418.53
8.1.160.0040.00421.88
8.1.150.0030.00518.79
8.1.140.0040.00417.40
8.1.130.0030.00317.89
8.1.120.0040.00417.32
8.1.110.0070.00017.45
8.1.100.0050.00217.31
8.1.90.0070.00017.32
8.1.80.0040.00417.43
8.1.70.0070.00017.38
8.1.60.0000.00817.52
8.1.50.0000.00817.57
8.1.40.0080.00017.42
8.1.30.0030.00617.65
8.1.20.0050.00517.71
8.1.10.0000.00717.57
8.1.00.0030.00517.38
8.0.300.0000.00720.09
8.0.290.0030.00616.63
8.0.280.0030.00318.31
8.0.270.0040.00417.10
8.0.260.0000.00617.18
8.0.250.0030.00316.88
8.0.240.0040.00417.01
8.0.230.0070.00016.95
8.0.220.0000.00716.77
8.0.210.0040.00416.82
8.0.200.0060.00016.83
8.0.190.0030.00316.96
8.0.180.0030.00516.89
8.0.170.0070.00016.79
8.0.160.0070.00316.93
8.0.150.0050.00216.83
8.0.140.0040.00416.91
8.0.130.0030.00313.32
8.0.120.0050.00316.89
8.0.110.0000.00716.82
8.0.100.0000.00716.80
8.0.90.0000.00716.78
8.0.80.0030.01416.88
8.0.70.0040.00416.74
8.0.60.0040.00416.94
8.0.50.0000.00916.71
8.0.30.0170.00616.91
8.0.20.0090.00917.40
8.0.10.0070.00017.13
8.0.00.0100.01116.74
7.4.330.0050.00015.03
7.4.320.0060.00016.47
7.4.300.0000.00816.56
7.4.290.0000.00716.61
7.4.280.0050.00316.65
7.4.270.0000.00716.54
7.4.260.0040.00416.64
7.4.250.0070.00016.49
7.4.240.0030.00316.56
7.4.230.0000.00716.51
7.4.220.0120.00616.64
7.4.210.0040.01116.55
7.4.200.0070.00016.40
7.4.160.0110.00616.50
7.4.150.0060.01517.40
7.4.140.0140.00317.86
7.4.130.0060.01316.45
7.4.120.0110.00516.59
7.4.110.0080.00816.44
7.4.100.0120.00616.39
7.4.90.0100.00716.36
7.4.80.0100.01319.39
7.4.70.0000.01716.64
7.4.60.0030.01416.42
7.4.50.0060.00016.57
7.4.40.0160.00716.43
7.4.30.0100.00516.30
7.4.00.0110.00715.20
7.3.330.0000.00613.32
7.3.320.0000.00613.07
7.3.310.0000.00716.29
7.3.300.0040.00416.28
7.3.290.0130.00716.29
7.3.280.0070.01116.31
7.3.270.0130.00317.40
7.3.260.0150.00416.36
7.3.250.0100.00916.41
7.3.240.0060.01616.46
7.3.230.0040.01216.51
7.3.210.0090.00616.27
7.3.200.0120.00819.39
7.3.190.0170.00316.48
7.3.180.0100.00616.53
7.3.170.0030.01316.45
7.3.160.0080.00816.38
7.2.330.0110.00716.78
7.2.320.0130.00716.76
7.2.310.0060.01016.30
7.2.300.0060.01816.57
7.2.290.0080.00816.70
7.2.60.0030.00616.74
7.1.200.0000.00815.52
7.1.100.0400.00615.79
7.1.70.0040.00716.73
7.1.60.0120.01219.40
7.1.50.0040.01516.84
7.1.00.0000.08022.35
7.0.200.0030.00516.56
7.0.140.0030.07722.00
7.0.60.0070.08019.93
7.0.50.0030.06717.90
7.0.40.0130.06720.01
7.0.30.0300.07320.20
7.0.20.0230.07020.25
7.0.10.0070.04720.09
7.0.00.0000.04320.10
5.6.280.0030.07321.11
5.6.210.0000.04720.55
5.6.200.0130.08018.24
5.6.190.0070.04020.47
5.6.180.0270.05720.48
5.6.170.0270.07020.41
5.6.160.0100.05020.46
5.6.150.0070.08018.25
5.6.140.0100.08018.21
5.6.130.0070.04318.28
5.6.120.0030.04021.13
5.6.110.0070.08320.97
5.6.100.0070.07721.00
5.6.90.0000.08020.99
5.6.80.0170.06720.43
5.5.350.4230.04020.40
5.5.340.0100.08017.97
5.5.330.0070.08320.19
5.5.320.0170.08320.29
5.5.310.0330.06320.36
5.5.300.0130.07318.03
5.5.290.0100.07717.97
5.5.280.0000.05020.89
5.5.270.0070.04020.66
5.5.260.0070.08320.69
5.5.250.0170.05320.66
5.5.240.0000.07020.17
5.4.450.0130.05319.27
5.4.440.0400.05019.49
5.4.430.0170.04719.51
5.4.420.0200.04319.16
5.4.410.0330.03319.19
5.4.400.0170.04019.09
5.4.390.0170.04319.05
5.4.380.0200.04718.69
5.4.370.0070.06018.56
5.4.360.0230.06318.62
5.4.350.0170.05718.48
5.4.340.0170.05718.74
5.4.320.0020.04112.52
5.4.310.0070.04312.52
5.4.300.0080.03512.52
5.4.290.0100.03512.51
5.4.280.0070.03512.41
5.4.270.0070.03512.41
5.4.260.0060.03712.41
5.4.250.0050.03812.41
5.4.240.0060.03712.41
5.4.230.0030.04112.40
5.4.220.0040.03812.40
5.4.210.0070.03412.39
5.4.200.0060.03812.39
5.4.190.0070.03412.40
5.4.180.0110.03512.39
5.4.170.0090.03412.41
5.4.160.0070.03512.41
5.4.150.0060.03712.40
5.4.140.0060.03712.08
5.4.130.0070.03312.07
5.4.120.0040.04212.02
5.4.110.0050.04012.02
5.4.100.0040.04012.03
5.4.90.0040.03812.03
5.4.80.0060.03612.03
5.4.70.0050.03512.02
5.4.60.0050.03512.02
5.4.50.0060.03612.02
5.4.40.0030.03812.01
5.4.30.0060.03812.00
5.4.20.0060.04212.00
5.4.10.0060.03512.00
5.4.00.0060.03711.50
5.3.290.0050.04012.80
5.3.280.0060.03712.71
5.3.270.0050.04312.72
5.3.260.0070.03912.72
5.3.250.0080.03512.72
5.3.240.0110.03212.72
5.3.230.0050.04412.71
5.3.220.0050.03912.68
5.3.210.0050.04112.68
5.3.200.0060.03712.68
5.3.190.0060.03812.68
5.3.180.0070.03712.68
5.3.170.0090.03512.67
5.3.160.0080.03612.68
5.3.150.0040.03812.68
5.3.140.0060.03612.66
5.3.130.0050.03912.66
5.3.120.0080.04112.66
5.3.110.0050.03912.66
5.3.100.0060.03612.13
5.3.90.0070.03512.11
5.3.80.0050.03812.11
5.3.70.0060.03612.11
5.3.60.0100.03912.09
5.3.50.0050.03712.04
5.3.40.0090.03312.04
5.3.30.0050.03711.99
5.3.20.0080.03211.78
5.3.10.0050.03511.74
5.3.00.0040.03811.73
5.2.170.0070.0329.23
5.2.160.0060.0279.23
5.2.150.0070.0289.23
5.2.140.0040.0319.23
5.2.130.0050.0289.19
5.2.120.0050.0299.19
5.2.110.0060.0289.20
5.2.100.0060.0359.20
5.2.90.0010.0349.20
5.2.80.0050.0299.19
5.2.70.0060.0279.19
5.2.60.0050.0289.14
5.2.50.0060.0299.11
5.2.40.0070.0359.09
5.2.30.0060.0359.06
5.2.20.0100.0349.05
5.2.10.0070.0368.95
5.2.00.0050.0298.82
5.1.60.0030.0258.10
5.1.50.0040.0268.10
5.1.40.0060.0238.08
5.1.30.0030.0278.44
5.1.20.0060.0288.45
5.1.10.0020.0288.18
5.1.00.0020.0288.18
5.0.50.0050.0196.66
5.0.40.0020.0216.52
5.0.30.0020.0326.33
5.0.20.0050.0186.29
5.0.10.0040.0196.27
5.0.00.0040.0306.27
4.4.90.0040.0144.78
4.4.80.0040.0144.75
4.4.70.0020.0164.75
4.4.60.0020.0174.76
4.4.50.0050.0134.77
4.4.40.0010.0274.71
4.4.30.0030.0154.76
4.4.20.0040.0154.85
4.4.10.0040.0154.85
4.4.00.0050.0234.75
4.3.110.0000.0184.67
4.3.100.0000.0184.66
4.3.90.0030.0144.63
4.3.80.0030.0244.58
4.3.70.0050.0124.63
4.3.60.0040.0134.63
4.3.50.0010.0174.63
4.3.40.0020.0254.54
4.3.30.0020.0163.30
4.3.20.0020.0163.28
4.3.10.0030.0153.23
4.3.00.0130.01715.89

preferences:
32.72 ms | 401 KiB | 5 Q