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 multiplyByTwo($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 . 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.40.0110.00418.79
8.3.30.0100.00319.04
8.3.20.0040.00420.16
8.3.10.0040.00421.73
8.3.00.0080.00019.79
8.2.170.0090.00622.96
8.2.160.0030.01020.52
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0060.01326.16
8.2.120.0040.00421.03
8.2.110.0030.00621.01
8.2.100.0070.00417.85
8.2.90.0000.00818.22
8.2.80.0060.00317.97
8.2.70.0060.00317.50
8.2.60.0000.00717.80
8.2.50.0030.00618.07
8.2.40.0020.00518.09
8.2.30.0000.00717.99
8.2.20.0040.00417.64
8.2.10.0000.00818.01
8.2.00.0000.00717.65
8.1.270.0080.00023.95
8.1.260.0090.00026.35
8.1.250.0060.00328.09
8.1.240.0040.00423.92
8.1.230.0040.00721.03
8.1.220.0090.00017.74
8.1.210.0000.00818.77
8.1.200.0070.00317.23
8.1.190.0060.00317.23
8.1.180.0060.00318.10
8.1.170.0000.00818.66
8.1.160.0080.00021.89
8.1.150.0000.00818.89
8.1.140.0050.00317.51
8.1.130.0000.00717.85
8.1.120.0040.00417.54
8.1.110.0050.00217.45
8.1.100.0000.00817.36
8.1.90.0000.00817.46
8.1.80.0000.00717.43
8.1.70.0070.00017.38
8.1.60.0030.00617.65
8.1.50.0040.00417.55
8.1.40.0030.00617.45
8.1.30.0000.00817.63
8.1.20.0000.00817.64
8.1.10.0000.00817.48
8.1.00.0000.00717.45
8.0.300.0040.00420.12
8.0.290.0000.00716.75
8.0.280.0000.00718.45
8.0.270.0040.00417.18
8.0.260.0030.00317.17
8.0.250.0050.00317.06
8.0.240.0000.00816.92
8.0.230.0000.00716.92
8.0.220.0040.00216.87
8.0.210.0030.00316.90
8.0.200.0000.00716.89
8.0.190.0000.00817.02
8.0.180.0080.00016.96
8.0.170.0040.00416.97
8.0.160.0100.00016.84
8.0.150.0030.00516.91
8.0.140.0030.00616.91
8.0.130.0030.00313.39
8.0.120.0050.00316.91
8.0.110.0040.00417.04
8.0.100.0070.00016.90
8.0.90.0000.00716.97
8.0.80.0040.01716.89
8.0.70.0050.00317.07
8.0.60.0000.00816.82
8.0.50.0080.00016.86
8.0.30.0080.01017.33
8.0.20.0080.01117.40
8.0.10.0050.00217.06
8.0.00.0090.00816.66
7.4.330.0050.00015.09
7.4.320.0060.00016.45
7.4.300.0000.00716.61
7.4.290.0070.00016.51
7.4.280.0050.00516.52
7.4.270.0000.00716.51
7.4.260.0070.00016.45
7.4.250.0000.00716.37
7.4.240.0020.00616.62
7.4.230.0070.00016.41
7.4.220.0030.01616.47
7.4.210.0190.00016.59
7.4.200.0000.00716.55
7.4.160.0060.01116.32
7.4.150.0090.00917.40
7.4.140.0130.01217.86
7.4.130.0080.00816.48
7.4.120.0130.00516.55
7.4.110.0130.00316.34
7.4.100.0090.00816.55
7.4.90.0110.00616.58
7.4.80.0100.00719.39
7.4.70.0100.00616.30
7.4.60.0110.00616.36
7.4.50.0030.00616.42
7.4.40.0080.00816.39
7.4.30.0140.00316.45
7.4.10.0080.01214.86
7.4.00.0070.01214.99
7.3.330.0030.00313.26
7.3.320.0030.00313.16
7.3.310.0070.00016.33
7.3.300.0040.00416.16
7.3.290.0110.00416.29
7.3.280.0090.00716.30
7.3.270.0030.01317.40
7.3.260.0100.01116.40
7.3.250.0060.01116.34
7.3.240.0090.00916.18
7.3.230.0030.01316.39
7.3.210.0100.00716.26
7.3.200.0060.01319.39
7.3.190.0130.00916.61
7.3.180.0030.01416.32
7.3.170.0090.00616.27
7.3.160.0140.00316.44
7.3.130.0100.01014.79
7.3.120.0050.01014.68
7.3.110.0080.00814.66
7.3.100.0030.01014.34
7.3.90.0120.00314.80
7.3.80.0000.01014.59
7.3.70.0000.01314.89
7.3.60.0000.01414.85
7.3.50.0060.01014.75
7.3.40.0030.01014.66
7.3.30.0110.00314.80
7.3.20.0000.00916.67
7.3.10.0060.00616.71
7.3.00.0090.00316.72
7.2.330.0090.01516.81
7.2.320.0030.01416.66
7.2.310.0110.00516.78
7.2.300.0120.00916.72
7.2.290.0000.01616.72
7.2.260.0030.01615.07
7.2.250.0050.01015.23
7.2.240.0060.00915.33
7.2.230.0030.01014.82
7.2.220.0080.00315.26
7.2.210.0000.01015.18
7.2.200.0090.00414.76
7.2.190.0030.01015.12
7.2.180.0000.01615.08
7.2.170.0070.00714.80
7.2.160.0130.00314.95
7.2.150.0070.00716.96
7.2.140.0000.01116.58
7.2.130.0020.01316.97
7.2.120.0030.01216.81
7.2.110.0090.00916.82
7.2.100.0050.00816.91
7.2.90.0090.00517.05
7.2.80.0140.00016.84
7.2.70.0040.01116.86
7.2.60.0040.00916.86
7.2.50.0060.00616.83
7.2.40.0050.01016.88
7.2.30.0030.00816.93
7.2.20.0030.00816.91
7.2.10.0030.01016.95
7.2.00.0050.00917.77
7.1.330.0080.00315.79
7.1.320.0070.00715.68
7.1.310.0000.01315.41
7.1.300.0000.01315.70
7.1.290.0000.01215.65
7.1.280.0030.01015.91
7.1.270.0100.00315.70
7.1.260.0030.01315.48
7.1.250.0040.00615.73
7.1.240.0050.00515.98
7.1.230.0090.00615.65
7.1.220.0060.00915.80
7.1.210.0030.00915.61
7.1.200.0070.00715.82
7.1.190.0070.00715.82
7.1.180.0080.00415.69
7.1.170.0070.00715.88
7.1.160.0070.00715.58
7.1.150.0090.00615.65
7.1.140.0030.01015.51
7.1.130.0030.01215.84
7.1.120.0030.00615.68
7.1.110.0090.00615.89
7.1.100.0020.01117.03
7.1.90.0000.01415.74
7.1.80.0000.00915.95
7.1.70.0090.00216.46
7.1.60.0080.01017.48
7.1.50.0130.00616.42
7.1.40.0030.01315.92
7.1.30.0000.01015.65
7.1.20.0040.01115.63
7.1.10.0040.00415.57
7.1.00.0040.04419.16
7.0.330.0040.01115.49
7.0.320.0070.00715.32
7.0.310.0080.00415.22
7.0.300.0030.01015.38
7.0.290.0040.00815.43
7.0.280.0040.01115.06
7.0.270.0000.01215.40
7.0.260.0100.00315.45
7.0.250.0000.01415.57
7.0.240.0040.01115.43
7.0.230.0030.00715.39
7.0.220.0030.01015.40
7.0.210.0120.00015.13
7.0.200.0000.01216.04
7.0.190.0030.00615.20
7.0.180.0080.00015.49
7.0.170.0100.00015.29
7.0.160.0070.01015.48
7.0.150.0080.00415.19
7.0.140.0070.04018.64
7.0.130.0000.01715.58
7.0.120.0060.00915.40
7.0.110.0060.00615.26
7.0.100.0110.00415.41
7.0.90.0060.00615.50
7.0.80.0060.00615.46
7.0.70.2350.02617.65
7.0.60.0100.01517.58
7.0.50.0110.01716.56
7.0.40.0060.02316.82
7.0.30.0140.04616.77
7.0.20.0250.03816.94
7.0.10.0150.03416.81
7.0.00.0050.04016.89
5.6.400.0000.01614.53
5.6.390.0090.00914.32
5.6.380.0140.00014.40
5.6.370.0030.01014.33
5.6.360.0000.01414.48
5.6.350.0030.01214.20
5.6.340.0060.00614.37
5.6.330.0030.01414.00
5.6.320.0030.01214.39
5.6.310.0030.00914.39
5.6.300.0070.00714.14
5.6.290.0060.00614.57
5.6.280.0010.04317.69
5.6.270.0040.00414.38
5.6.260.0030.01014.30
5.6.250.0030.01014.46
5.6.240.0030.00714.20
5.6.230.0100.00314.71
5.6.220.0100.00314.31
5.6.210.0020.02717.45
5.6.200.0060.04516.34
5.6.190.0100.04317.31
5.6.180.0180.03017.26
5.6.170.0220.04217.36
5.6.160.0080.05017.48
5.6.150.0070.03316.26
5.6.140.0080.04316.36
5.6.130.0080.04716.36
5.6.120.0080.04317.81
5.6.110.0040.02417.86
5.6.100.0090.04417.55
5.6.90.0100.01817.77
5.6.80.0010.02617.29
5.6.70.0160.04217.30
5.6.60.0070.00714.25
5.6.50.0040.01114.42
5.6.40.0030.01414.49
5.6.30.0060.00314.20
5.6.20.0040.01114.15
5.6.10.0060.00914.34
5.6.00.0040.01114.14
5.5.380.0000.01114.28
5.5.370.0060.00813.98
5.5.360.0030.01014.28
5.5.350.0140.03817.58
5.5.340.0030.04816.06
5.5.330.0050.05117.23
5.5.320.0070.02517.34
5.5.310.0150.03117.37
5.5.300.0110.04316.16
5.5.290.0080.02016.32
5.5.280.0100.04317.63
5.5.270.0100.04017.58
5.5.260.0050.04717.54
5.5.250.0110.04017.29
5.5.240.0010.02317.12
5.5.230.0060.00614.20
5.5.220.0120.00314.45
5.5.210.0070.01014.35
5.5.200.0000.01114.23
5.5.190.0040.01114.00
5.5.180.0030.01014.36
5.5.170.0040.01114.49
5.5.160.0030.01013.93
5.5.150.0070.00714.01
5.5.140.0030.01214.33
5.5.130.0030.00814.32
5.5.120.0100.00314.30
5.5.110.0090.00614.10
5.5.100.0070.00714.30
5.5.90.0040.00813.88
5.5.80.0140.00014.47
5.5.70.0060.00614.23
5.5.60.0070.00714.49
5.5.50.0030.01014.11
5.5.40.0030.01014.32
5.5.30.0040.00814.35
5.5.20.0060.00614.20
5.5.10.0060.00814.22
5.5.00.0000.01714.05
5.4.450.1530.01815.18
5.4.440.1630.02315.37
5.4.430.1600.02715.32
5.4.420.1670.02015.25
5.4.410.1630.02315.23
5.4.400.1800.02215.05
5.4.390.1750.02615.26
5.4.380.1630.02215.23
5.4.370.1330.02015.09
5.4.360.1510.01815.13
5.4.350.1650.02415.00
5.4.340.1590.02115.13
5.4.330.0030.00911.07
5.4.320.1660.01914.82
5.4.310.1610.02415.19
5.4.300.1620.02215.11
5.4.290.1730.02815.35
5.4.280.1580.02415.27
5.4.270.1530.02015.00
5.4.260.1600.01815.03
5.4.250.1650.02315.01
5.4.240.1650.02415.15
5.4.230.1640.01815.37
5.4.220.1660.02014.90
5.4.210.1700.02315.13
5.4.200.1580.02315.08
5.4.190.1670.02414.86
5.4.180.1680.02315.09
5.4.170.1580.02015.09
5.4.160.1580.02015.22
5.4.150.1540.02015.28
5.4.140.1700.02213.78
5.4.130.1670.01913.75
5.4.120.1560.02113.84
5.4.110.1570.01913.70
5.4.100.1620.02513.82
5.4.90.1550.02213.98
5.4.80.1870.01813.83
5.4.70.1730.02213.88
5.4.60.1680.02113.89
5.4.50.1530.01813.88
5.4.40.1620.02213.72
5.4.30.1660.02313.70
5.4.20.1720.01513.73
5.4.10.1640.02213.82
5.4.00.1680.01813.35
5.3.290.1620.02212.74
5.3.280.1600.01912.60
5.3.270.1660.02012.64
5.3.260.1630.02512.64
5.3.250.1580.02012.55
5.3.240.1570.02612.48
5.3.230.1620.02412.55
5.3.220.1680.01712.41
5.3.210.1780.02512.53
5.3.200.1640.01812.61
5.3.190.1700.02012.42
5.3.180.1480.02312.62
5.3.170.1580.02512.59
5.3.160.1780.02012.52
5.3.150.1580.02312.63
5.3.140.1630.02512.59
5.3.130.1610.02312.61
5.3.120.1500.02012.59
5.3.110.1630.02212.54
5.3.100.1610.02112.37
5.3.90.1510.02112.35
5.3.80.1830.02612.11
5.3.70.1800.01812.23
5.3.60.1640.01512.34
5.3.50.1680.02312.28
5.3.40.1530.02212.27
5.3.30.1620.01512.26
5.3.20.1500.02112.10
5.3.10.1820.02011.93
5.3.00.1560.01512.14
5.2.170.2800.03011.07
5.2.160.2800.02711.24
5.2.150.3030.03011.07
5.2.140.2600.03311.30
5.2.130.3470.02311.07
5.2.120.2500.03311.21
5.2.110.0200.03311.02
5.2.100.0130.03011.27
5.2.90.0130.03011.27
5.2.80.0100.03011.02
5.2.70.0070.04311.19
5.2.60.0070.03311.07
5.2.50.0230.03011.08
5.2.40.0030.03311.23
5.2.30.0130.03710.89
5.2.20.0100.03010.98
5.2.10.0070.03311.09
5.2.00.0130.02710.63
5.1.60.0130.02310.24
5.1.50.0170.0179.94
5.1.40.0130.02010.00
5.1.30.0100.02710.27
5.1.20.0100.02310.45
5.1.10.0030.0339.98
5.1.00.0130.02710.01
5.0.50.0030.0208.46
5.0.40.0030.0208.65
5.0.30.0030.0308.17
5.0.20.0130.0108.11
5.0.10.0030.0278.36
5.0.00.0070.0308.15
4.4.90.0100.0106.09
4.4.80.0070.0176.10
4.4.70.0070.0176.11
4.4.60.0000.0206.12
4.4.50.0070.0176.13
4.4.40.0070.0236.13
4.4.30.0070.0276.27
4.4.20.0030.0206.27
4.4.10.0030.0176.27
4.4.00.0030.0306.27
4.3.110.0070.0376.27
4.3.100.0030.0276.27
4.3.90.0070.0136.27
4.3.80.0070.0336.27
4.3.70.0030.0176.27
4.3.60.0030.0176.27
4.3.50.0070.0136.27
4.3.40.0030.0236.27
4.3.30.0030.0136.27
4.3.20.0030.0136.27
4.3.10.0030.0176.28
4.3.00.0030.0176.28

preferences:
50.95 ms | 400 KiB | 5 Q