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) . '<br><br>'; // 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.31
8.3.50.0120.00722.95
8.3.40.0110.00418.96
8.3.30.0110.00319.21
8.3.20.0040.00420.29
8.3.10.0050.00221.72
8.3.00.0080.00019.81
8.2.180.0070.01516.63
8.2.170.0040.01122.96
8.2.160.0130.00020.55
8.2.150.0040.00424.18
8.2.140.0050.00224.66
8.2.130.0150.00026.16
8.2.120.0040.00421.01
8.2.110.0060.00319.39
8.2.100.0040.01117.72
8.2.90.0000.00917.72
8.2.80.0000.00817.97
8.2.70.0030.00617.93
8.2.60.0060.00317.92
8.2.50.0000.00818.10
8.2.40.0040.00422.36
8.2.30.0080.00018.08
8.2.20.0030.00617.75
8.2.10.0000.00717.97
8.2.00.0060.00317.76
8.1.280.0110.00425.92
8.1.270.0050.00323.95
8.1.260.0080.00026.35
8.1.250.0030.00528.09
8.1.240.0060.00321.98
8.1.230.0110.00020.95
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0030.00717.35
8.1.190.0000.00817.25
8.1.180.0000.00818.10
8.1.170.0000.00918.64
8.1.160.0040.00421.93
8.1.150.0000.00718.94
8.1.140.0040.00417.52
8.1.130.0000.00717.71
8.1.120.0040.00417.52
8.1.110.0000.00817.50
8.1.100.0000.00817.45
8.1.90.0000.00817.36
8.1.80.0050.00217.36
8.1.70.0000.00717.35
8.1.60.0090.00017.62
8.1.50.0050.00317.44
8.1.40.0040.00417.52
8.1.30.0000.00817.55
8.1.20.0000.00817.66
8.1.10.0000.00817.64
8.1.00.0030.00517.54
8.0.300.0040.00420.04
8.0.290.0000.00716.88
8.0.280.0030.00318.51
8.0.270.0030.00317.18
8.0.260.0030.00317.18
8.0.250.0070.00017.04
8.0.240.0080.00017.09
8.0.230.0070.00016.99
8.0.220.0070.00016.91
8.0.210.0070.00017.03
8.0.200.0040.00417.02
8.0.190.0030.00516.91
8.0.180.0000.00717.05
8.0.170.0040.00417.05
8.0.160.0100.00017.04
8.0.150.0040.00416.94
8.0.140.0050.00316.80
8.0.130.0000.00613.37
8.0.120.0000.00816.92
8.0.110.0000.00717.00
8.0.100.0040.00416.86
8.0.90.0070.00016.85
8.0.80.0120.00116.86
8.0.70.0000.00816.98
8.0.60.0000.00816.99
8.0.50.0000.00716.84
8.0.30.0030.01517.12
8.0.20.0090.00917.40
8.0.10.0000.00717.14
8.0.00.0110.00816.66
7.4.330.0050.00015.00
7.4.320.0060.00016.59
7.4.300.0030.00316.50
7.4.290.0040.00416.61
7.4.280.0030.00716.44
7.4.270.0030.00316.63
7.4.260.0070.00016.45
7.4.250.0000.00716.50
7.4.240.0000.00716.56
7.4.230.0000.00716.71
7.4.220.0110.00716.54
7.4.210.0100.00616.52
7.4.200.0030.00316.50
7.4.160.0060.01016.55
7.4.150.0070.01117.40
7.4.140.0170.01617.86
7.4.130.0100.00816.60
7.4.120.0030.01516.48
7.4.110.0090.00916.57
7.4.100.0160.00316.42
7.4.90.0070.01016.55
7.4.80.0030.01919.39
7.4.70.0110.00516.52
7.4.60.0030.01416.47
7.4.50.0000.00916.53
7.4.40.0120.00916.45
7.4.30.0120.00816.66
7.4.10.0000.01714.98
7.4.00.0060.01115.02
7.3.330.0000.00613.24
7.3.320.0060.00013.31
7.3.310.0070.00016.32
7.3.300.0040.00416.29
7.3.290.0140.00316.30
7.3.280.0070.00916.32
7.3.270.0100.00717.40
7.3.260.0070.01316.30
7.3.250.0080.00816.61
7.3.240.0150.00416.57
7.3.230.0090.00616.48
7.3.210.0140.00316.23
7.3.200.0120.01619.39
7.3.190.0110.01116.38
7.3.180.0090.00916.25
7.3.170.0130.00316.59
7.3.160.0070.01016.25
7.3.130.0070.01114.84
7.3.120.0060.01215.00
7.3.110.0030.01214.66
7.3.100.0100.00514.76
7.3.90.0090.00614.79
7.3.80.0050.01014.95
7.3.70.0020.01014.87
7.3.60.0050.01014.85
7.3.50.0080.00414.54
7.3.40.0000.01014.69
7.3.30.0040.00914.61
7.3.20.0060.01016.62
7.3.10.0070.00916.56
7.3.00.0060.00616.52
7.2.330.0060.01216.64
7.2.320.0090.00916.69
7.2.310.0070.01016.45
7.2.300.0070.01316.69
7.2.290.0080.00816.86
7.2.260.0030.01314.90
7.2.250.0100.01015.30
7.2.240.0030.01115.18
7.2.230.0130.00315.10
7.2.220.0080.00815.01
7.2.210.0090.00515.20
7.2.200.0050.01015.22
7.2.190.0110.00515.07
7.2.180.0060.00915.03
7.2.170.0070.00615.12
7.2.160.0020.01215.06
7.2.150.0080.00616.78
7.2.140.0020.00916.73
7.2.130.0070.00816.99
7.2.120.0030.01417.01
7.2.110.0050.00916.78
7.2.100.0050.01116.87
7.2.90.0090.00716.92
7.2.80.0050.01017.00
7.2.70.0030.01417.05
7.2.60.0000.01116.92
7.2.50.0050.01216.96
7.2.40.0040.01116.91
7.2.30.0050.01217.03
7.2.20.0090.00717.13
7.2.10.0070.00916.87
7.2.00.0080.00617.82
7.1.330.0100.00515.74
7.1.320.0060.01115.64
7.1.310.0060.00715.85
7.1.300.0120.00315.76
7.1.290.0070.00715.78
7.1.280.0070.00615.60
7.1.270.0050.00615.86
7.1.260.0040.01015.80
7.1.250.0050.00615.70
7.1.240.0040.00415.84
7.1.230.0030.01016.00
7.1.220.0070.01115.79
7.1.210.0100.00316.02
7.1.200.0040.01115.91
7.1.190.0110.00415.78
7.1.180.0070.00415.77
7.1.170.0080.00815.87
7.1.160.0050.00315.60
7.1.150.0030.01215.86
7.1.140.0040.00815.71
7.1.130.0030.01215.48
7.1.120.0000.01515.99
7.1.110.0090.00615.63
7.1.100.0020.01016.87
7.1.90.0030.01115.36
7.1.80.0030.00615.84
7.1.70.0060.00416.59
7.1.60.0110.00917.68
7.1.50.0080.01116.26
7.1.40.0000.01415.84
7.1.30.0060.00915.90
7.1.20.0040.00715.95
7.1.10.0070.00715.87
7.1.00.0070.03919.16
7.0.330.0040.01115.46
7.0.320.0070.01015.63
7.0.310.0030.01015.45
7.0.300.0070.00715.43
7.0.290.0030.01015.24
7.0.280.0040.00415.59
7.0.270.0100.00415.34
7.0.260.0030.01215.39
7.0.250.0000.00815.51
7.0.240.0030.01015.55
7.0.230.0080.00815.45
7.0.220.0030.00615.28
7.0.210.0060.00615.36
7.0.200.0030.00916.07
7.0.190.0000.01415.41
7.0.180.0070.00715.23
7.0.170.0090.00015.51
7.0.160.0030.00915.26
7.0.150.0000.00815.14
7.0.140.0050.04218.69
7.0.130.0040.01115.42
7.0.120.0030.00615.61
7.0.110.0040.01115.25
7.0.100.0080.00615.47
7.0.90.0090.00015.63
7.0.80.0090.00615.46
7.0.70.0070.00715.22
7.0.60.0100.04417.77
7.0.50.0030.04816.64
7.0.40.0070.04816.96
7.0.30.0300.04116.92
7.0.20.0230.03816.83
7.0.10.0130.04716.92
7.0.00.0080.04316.84
5.6.400.0070.00314.39
5.6.390.0040.00414.73
5.6.380.0050.00514.66
5.6.370.0050.00514.39
5.6.360.0040.01114.18
5.6.350.0060.00914.43
5.6.340.0030.01214.42
5.6.330.0070.00714.41
5.6.320.0030.01014.07
5.6.310.0040.00714.16
5.6.300.0100.00314.59
5.6.290.0030.01314.14
5.6.280.0040.04117.72
5.6.270.0100.00714.28
5.6.260.0140.00014.47
5.6.250.0000.01614.56
5.6.240.0040.00414.37
5.6.230.0030.01214.48
5.6.220.0090.00814.52
5.6.210.0150.02017.50
5.6.200.0070.04716.35
5.6.190.0020.02617.47
5.6.180.0130.03117.46
5.6.170.0120.03417.36
5.6.160.0050.04217.56
5.6.150.0070.05016.32
5.6.140.0050.02116.29
5.6.130.0120.02316.24
5.6.120.0070.04717.81
5.6.110.0100.03317.58
5.6.100.0180.03817.87
5.6.90.0080.02317.92
5.6.80.0080.04417.27
5.6.70.2310.02317.32
5.6.60.0000.01714.54
5.6.50.0040.00814.30
5.6.40.0000.01514.21
5.6.30.0040.00814.59
5.6.20.0090.00614.11
5.6.10.0000.01414.38
5.6.00.0050.00514.19
5.5.380.0090.00614.49
5.5.370.0090.00614.52
5.5.360.0060.00914.31
5.5.350.0070.04017.44
5.5.340.0100.04316.25
5.5.330.0030.02817.20
5.5.320.0270.03117.28
5.5.310.0150.03017.26
5.5.300.0050.04516.01
5.5.290.0070.04716.23
5.5.280.0080.02817.66
5.5.270.0080.03717.66
5.5.260.0050.05017.48
5.5.250.0050.04417.21
5.5.240.0160.03617.26
5.5.230.0130.00514.47
5.5.220.0090.01214.40
5.5.210.0060.00614.17
5.5.200.0040.01214.14
5.5.190.0030.01014.32
5.5.180.0040.00714.36
5.5.170.0000.01414.41
5.5.160.0040.00714.31
5.5.150.0030.01014.26
5.5.140.0100.00314.12
5.5.130.0040.01214.05
5.5.120.0000.01414.52
5.5.110.0050.01014.16
5.5.100.0030.01213.96
5.5.90.0060.00913.93
5.5.80.0030.00914.24
5.5.70.0090.00313.98
5.5.60.0000.01313.96
5.5.50.0040.00814.39
5.5.40.0100.00314.14
5.5.30.0050.00514.41
5.5.20.0030.00614.41
5.5.10.0100.00314.34
5.5.00.0070.01014.25
5.4.450.0320.02815.44
5.4.440.0130.02415.41
5.4.430.0120.02215.23
5.4.420.0130.02315.19
5.4.410.0170.02415.19
5.4.400.0130.02415.10
5.4.390.0140.02615.09
5.4.380.0130.02714.94
5.4.370.0110.02714.77
5.4.360.0090.02814.76
5.4.350.0050.03514.76
5.4.340.0120.02714.90
5.4.330.0040.00811.23
5.4.320.0070.02111.86
5.4.310.0080.02011.75
5.4.300.0040.02111.83
5.4.290.0030.02311.87
5.4.280.0070.02411.65
5.4.270.0090.02411.74
5.4.260.0050.02211.66
5.4.250.0060.02111.82
5.4.240.0050.02211.68
5.4.230.0020.02311.75
5.4.220.0060.02311.67
5.4.210.0060.02011.73
5.4.200.0070.02411.79
5.4.190.0060.02211.80
5.4.180.0060.01811.73
5.4.170.0080.02411.63
5.4.160.0020.02211.60
5.4.150.0040.02211.63
5.4.140.0040.02311.67
5.4.130.0070.02111.54
5.4.120.0050.02111.51
5.4.110.0040.02211.49
5.4.100.0040.02011.46
5.4.90.0050.02211.55
5.4.80.0030.02311.60
5.4.70.0070.02011.36
5.4.60.0030.02211.46
5.4.50.0020.02711.33
5.4.40.0070.01711.64
5.4.30.0050.01911.67
5.4.20.0040.02211.59
5.4.10.0050.02011.51
5.4.00.0070.01811.32
5.3.290.0060.02311.71
5.3.280.0060.02111.58
5.3.270.0060.02211.72
5.3.260.0040.02311.71
5.3.250.0060.02411.71
5.3.240.0060.01911.67
5.3.230.0060.02111.65
5.3.220.0040.02111.56
5.3.210.0060.02611.58
5.3.200.0050.02311.47
5.3.190.0060.02211.61
5.3.180.0080.02211.59
5.3.170.0080.01911.56
5.3.160.0030.02211.67
5.3.150.0070.02111.50
5.3.140.0020.02411.63
5.3.130.0030.02611.61
5.3.120.0060.02111.63
5.3.110.0050.02111.63
5.3.100.0040.02411.37
5.3.90.0040.02511.29
5.3.80.0040.02211.30
5.3.70.0040.02511.32
5.3.60.0060.02211.34
5.3.50.0060.02011.29
5.3.40.0090.02011.20
5.3.30.0050.01911.23
5.3.20.0060.01911.04
5.3.10.0020.02111.06
5.3.00.0030.02410.97
5.2.170.0090.0409.23
5.2.160.0090.0319.23
5.2.150.0120.0319.23
5.2.140.0070.0409.23
5.2.130.0050.0319.19
5.2.120.0090.0279.19
5.2.110.0070.0279.20
5.2.100.0050.0309.20
5.2.90.0030.0339.19
5.2.80.0050.0329.19
5.2.70.0050.0409.18
5.2.60.0060.0339.14
5.2.50.0050.0309.11
5.2.40.0050.0339.09
5.2.30.0070.0309.06
5.2.20.0110.0369.05
5.2.10.0050.0318.95
5.2.00.0040.0308.82
5.1.60.0070.0298.10
5.1.50.0060.0228.10
5.1.40.0060.0228.08
5.1.30.0050.0258.43
5.1.20.0050.0298.45
5.1.10.0030.0278.18
5.1.00.0030.0278.18
5.0.50.0070.0186.65
5.0.40.0030.0206.52
5.0.30.0060.0306.32
5.0.20.0050.0236.30
5.0.10.0050.0256.28
5.0.00.0030.0336.27
4.4.90.0020.0164.78
4.4.80.0030.0154.76
4.4.70.0020.0174.75
4.4.60.0030.0154.76
4.4.50.0020.0164.77
4.4.40.0050.0244.71
4.4.30.0040.0204.76
4.4.20.0020.0184.84
4.4.10.0030.0224.85
4.4.00.0030.0284.76
4.3.110.0030.0154.67
4.3.100.0040.0184.67
4.3.90.0070.0174.64
4.3.80.0020.0314.58
4.3.70.0030.0144.63
4.3.60.0060.0124.62
4.3.50.0090.0114.63
4.3.40.0040.0264.54
4.3.30.0040.0133.30
4.3.20.0020.0243.28
4.3.10.0010.0173.24
4.3.00.0070.01715.89

preferences:
59.4 ms | 400 KiB | 5 Q