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->hassan, $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.0090.00618.11
8.3.50.0110.00522.87
8.3.40.0110.00718.88
8.3.30.0030.01019.02
8.3.20.0070.00020.13
8.3.10.0090.00021.86
8.3.00.0080.00017.93
8.2.180.0120.00616.88
8.2.170.0090.00622.96
8.2.160.0070.00720.53
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0150.00426.16
8.2.120.0080.00820.86
8.2.110.0160.00719.20
8.2.100.0110.00017.78
8.2.90.0000.00818.94
8.2.80.0060.00317.97
8.2.70.0000.00817.50
8.2.60.0040.00417.80
8.2.50.0040.00418.07
8.2.40.0000.00818.22
8.2.30.0000.00817.94
8.2.20.0030.00517.62
8.2.10.0050.00217.89
8.2.00.0040.00417.80
8.1.280.0150.00025.92
8.1.270.0000.00823.77
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00720.78
8.1.230.0080.00417.42
8.1.220.0030.00517.74
8.1.210.0000.00818.77
8.1.200.0060.00317.25
8.1.190.0080.00017.22
8.1.180.0040.00418.10
8.1.170.0040.00418.58
8.1.160.0040.00422.00
8.1.150.0040.00418.75
8.1.140.0080.00017.44
8.1.130.0040.00417.41
8.1.120.0040.00417.41
8.1.110.0030.00517.35
8.1.100.0050.00317.30
8.1.90.0040.00417.31
8.1.80.0070.00017.31
8.1.70.0070.00017.38
8.1.60.0060.00317.55
8.1.50.0040.00417.55
8.1.40.0000.00717.50
8.1.30.0050.00517.63
8.1.20.0040.00417.59
8.1.10.0040.00417.54
8.1.00.0030.00517.41
8.0.300.0050.00218.77
8.0.290.0000.00716.63
8.0.280.0070.00018.46
8.0.270.0000.00717.17
8.0.260.0070.00016.86
8.0.250.0000.00616.95
8.0.240.0000.00816.91
8.0.230.0000.00716.93
8.0.220.0030.00316.88
8.0.210.0040.00416.94
8.0.200.0030.00316.94
8.0.190.0000.00816.96
8.0.180.0050.00216.94
8.0.170.0030.00516.82
8.0.160.0030.00616.96
8.0.150.0030.00516.87
8.0.140.0000.00816.92
8.0.130.0000.00513.39
8.0.120.0060.00316.88
8.0.110.0040.00416.90
8.0.100.0040.00416.76
8.0.90.0050.00316.78
8.0.80.0090.01316.95
8.0.70.0000.00716.73
8.0.60.0000.00816.94
8.0.50.0050.00216.95
8.0.30.0160.00517.19
8.0.20.0160.00617.40
8.0.10.0080.00017.02
8.0.00.0060.01416.80
7.4.330.0000.00615.05
7.4.320.0030.00316.42
7.4.300.0000.00716.51
7.4.290.0050.00316.50
7.4.280.0030.00516.51
7.4.270.0000.00716.66
7.4.260.0060.00316.57
7.4.250.0050.00316.45
7.4.240.0020.00616.64
7.4.230.0000.00716.61
7.4.220.0100.00716.50
7.4.210.0000.01416.64
7.4.200.0000.00716.55
7.4.160.0090.00616.48
7.4.150.0030.01517.40
7.4.140.0090.00917.86
7.4.130.0060.01116.58
7.4.120.0070.01016.53
7.4.110.0070.01016.40
7.4.100.0060.01216.46
7.4.90.0080.01116.62
7.4.80.0110.00619.39
7.4.70.0080.00816.65
7.4.60.0140.00316.61
7.4.50.0000.00716.57
7.4.40.0080.01316.50
7.4.30.0080.00816.46
7.4.00.0060.01014.93
7.3.330.0000.00613.17
7.3.320.0000.00613.18
7.3.310.0040.00416.30
7.3.300.0030.00616.36
7.3.290.0060.00716.30
7.3.280.0100.00616.26
7.3.270.0030.01417.40
7.3.260.0060.01116.27
7.3.250.0130.00316.41
7.3.240.0060.01616.48
7.3.230.0090.00916.39
7.3.210.0110.00616.46
7.3.200.0060.01519.39
7.3.190.0090.00916.17
7.3.180.0080.00816.60
7.3.170.0090.00716.27
7.3.160.0160.00016.50
7.2.330.0060.01216.71
7.2.320.0150.00316.40
7.2.310.0030.01516.50
7.2.300.0130.00616.40
7.2.290.0060.01016.42
7.2.60.0070.00716.65
7.2.00.0030.01019.36
7.1.200.0030.01015.60
7.1.100.0090.00517.80
7.1.70.0030.01316.95
7.1.60.0100.01419.40
7.1.50.0030.01716.85
7.1.00.0000.08022.48
7.0.200.0000.00816.80
7.0.140.0000.08021.95
7.0.60.0270.06719.95
7.0.50.0100.08017.88
7.0.40.0000.04720.04
7.0.30.0270.07720.06
7.0.20.0300.07020.23
7.0.10.0200.07720.01
7.0.00.0070.04320.14
5.6.280.0000.07721.09
5.6.210.0030.07320.57
5.6.200.0070.05318.18
5.6.190.0070.08320.67
5.6.180.3600.04320.46
5.6.170.0270.05320.48
5.6.160.0100.07320.61
5.6.150.0070.08018.28
5.6.140.0070.08718.18
5.6.130.0030.08718.28
5.6.120.0070.08021.15
5.6.110.0070.07021.12
5.6.100.0100.07321.04
5.6.90.0030.04320.89
5.6.80.0100.07720.44
5.5.350.0230.07320.39
5.5.340.0100.06718.01
5.5.330.0070.04020.35
5.5.320.0270.06020.35
5.5.310.0230.07020.27
5.5.300.0030.08317.98
5.5.290.0130.05718.00
5.5.280.0070.04720.91
5.5.270.0030.09020.98
5.5.260.0030.06020.89
5.5.250.0070.07320.48
5.5.240.0230.08020.08
5.4.450.0800.02719.55
5.4.440.0230.04319.41
5.4.430.0370.04319.41
5.4.420.0200.04719.48
5.4.410.0270.04019.29
5.4.400.0300.03318.99
5.4.390.0300.04019.05
5.4.380.0130.06018.69
5.4.370.0070.08718.77
5.4.360.0100.06318.70
5.4.350.0130.05718.70
5.4.340.0100.06018.73
5.4.320.0060.03712.52
5.4.310.0090.04812.51
5.4.300.0110.03212.52
5.4.290.0060.04012.50
5.4.280.0090.03412.41
5.4.270.0040.03712.41
5.4.260.0050.03812.41
5.4.250.0080.03712.40
5.4.240.0100.03212.40
5.4.230.0080.04512.40
5.4.220.0120.02912.40
5.4.210.0050.03512.40
5.4.200.0050.03712.40
5.4.190.0050.03912.39
5.4.180.0050.03712.39
5.4.170.0100.03212.41
5.4.160.0090.03312.40
5.4.150.0080.03312.40
5.4.140.0040.03812.09
5.4.130.0060.03512.07
5.4.120.0050.03612.03
5.4.110.0040.03812.02
5.4.100.0100.03512.03
5.4.90.0070.03612.02
5.4.80.0080.03512.03
5.4.70.0070.03512.02
5.4.60.0060.03712.02
5.4.50.0080.03312.02
5.4.40.0070.03312.01
5.4.30.0030.03812.00
5.4.20.0120.04012.00
5.4.10.0060.03412.01
5.4.00.0030.03911.50
5.3.290.0050.04112.80
5.3.280.0070.03712.71
5.3.270.0050.04112.72
5.3.260.0070.04112.72
5.3.250.0050.03712.72
5.3.240.0090.03812.72
5.3.230.0060.03812.71
5.3.220.0090.03512.68
5.3.210.0090.05812.68
5.3.200.0080.05312.68
5.3.190.0100.04712.68
5.3.180.0090.03512.68
5.3.170.0080.03512.67
5.3.160.0100.03312.68
5.3.150.0070.03712.67
5.3.140.0080.03512.66
5.3.130.0050.04112.66
5.3.120.0080.04212.66
5.3.110.0050.04512.65
5.3.100.0050.03712.13
5.3.90.0100.03112.11
5.3.80.0070.03512.11
5.3.70.0090.03312.10
5.3.60.0040.04412.09
5.3.50.0060.03612.04
5.3.40.0050.03812.04
5.3.30.0070.03312.00
5.3.20.0080.03311.78
5.3.10.0060.03411.74
5.3.00.0090.03611.73
5.2.170.0080.0279.23
5.2.160.0040.0299.23
5.2.150.0050.0309.23
5.2.140.0050.0339.23
5.2.130.0040.0289.19
5.2.120.0040.0339.19
5.2.110.0050.0309.20
5.2.100.0010.0329.20
5.2.90.0060.0329.19
5.2.80.0050.0309.19
5.2.70.0040.0309.19
5.2.60.0040.0319.14
5.2.50.0040.0309.11
5.2.40.0040.0289.09
5.2.30.0060.0299.07
5.2.20.0100.0329.05
5.2.10.0060.0278.96
5.2.00.0050.0288.82
5.1.60.0020.0268.11
5.1.50.0030.0268.10
5.1.40.0070.0228.08
5.1.30.0080.0238.43
5.1.20.0030.0288.45
5.1.10.0020.0298.18
5.1.00.0020.0288.18
5.0.50.0040.0206.66
5.0.40.0040.0196.52
5.0.30.0050.0336.32
5.0.20.0050.0206.29
5.0.10.0020.0286.28
5.0.00.0040.0336.27
4.4.90.0020.0184.78
4.4.80.0020.0174.75
4.4.70.0050.0154.75
4.4.60.0020.0164.76
4.4.50.0000.0184.77
4.4.40.0030.0254.71
4.4.30.0040.0164.76
4.4.20.0030.0154.85
4.4.10.0020.0174.85
4.4.00.0030.0284.76
4.3.110.0010.0174.67
4.3.100.0060.0124.67
4.3.90.0030.0164.63
4.3.80.0040.0234.58
4.3.70.0030.0144.63
4.3.60.0020.0154.63
4.3.50.0020.0164.63
4.3.40.0030.0274.54
4.3.30.0020.0163.30
4.3.20.0040.0183.28
4.3.10.0030.0193.23
4.3.00.0030.02015.89

preferences:
35.04 ms | 401 KiB | 5 Q