3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Challenge 2: Implement AnswerInterface and get Question to echo "4". */ class Question { public function __construct(AnswerInterface $answer) { echo "What is 2 + 2?\n"; $answer = $answer->get()->the()->answer(); if ($answer instanceof AnswerInterface) { echo $answer . PHP_EOL; } } } interface AnswerInterface { public function get(); public function the(); public function answer(); } // start editing here class Answer implements AnswerInterface { public function get() { } public function the() { return $this->get(); } public function answer() { return $this->get()->the(); } } // end editing here $answer = new Answer; $question = new Question($answer);

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.0130.00618.88
8.3.30.0120.00319.13
8.3.20.0080.00020.04
8.3.10.0040.00423.53
8.3.00.0050.00319.38
8.2.170.0140.00022.96
8.2.160.0100.00320.39
8.2.150.0070.00024.18
8.2.140.0080.00024.66
8.2.130.0030.01026.16
8.2.120.0040.00422.20
8.2.110.0060.00321.87
8.2.100.0080.00317.78
8.2.90.0030.00519.09
8.2.80.0000.01018.04
8.2.70.0060.00317.75
8.2.60.0070.00517.80
8.2.50.0040.00718.07
8.2.40.0030.00520.07
8.2.30.0000.00718.13
8.2.20.0080.00017.75
8.2.10.0040.00419.91
8.2.00.0040.00417.79
8.1.270.0160.00023.60
8.1.260.0000.00726.35
8.1.250.0020.00528.09
8.1.240.0060.00323.91
8.1.230.0070.00319.09
8.1.220.0000.00817.74
8.1.210.0050.00318.77
8.1.200.0000.00917.25
8.1.190.0080.00017.52
8.1.180.0000.01018.10
8.1.170.0080.00018.51
8.1.160.0000.00721.92
8.1.150.0000.00818.65
8.1.140.0040.00417.51
8.1.130.0000.00717.70
8.1.120.0040.00417.36
8.1.110.0060.00317.51
8.1.100.0000.00717.43
8.1.90.0000.00717.49
8.1.80.0050.00317.46
8.1.70.0000.00717.42
8.1.60.0060.00317.46
8.1.50.0030.00517.52
8.1.40.0040.00417.51
8.1.30.0040.00417.59
8.1.20.0040.00417.58
8.1.10.0000.00817.50
8.1.00.0040.00417.43
8.0.300.0040.00419.15
8.0.290.0070.00017.18
8.0.280.0030.00318.44
8.0.270.0000.00717.19
8.0.260.0000.00917.13
8.0.250.0070.00017.00
8.0.240.0050.00516.91
8.0.230.0000.00716.97
8.0.220.0000.00716.83
8.0.210.0000.00817.01
8.0.200.0030.00316.99
8.0.190.0070.00016.97
8.0.180.0040.00716.98
8.0.170.0050.00216.90
8.0.160.0000.00716.93
8.0.150.0000.00716.80
8.0.140.0030.00516.88
8.0.130.0060.00013.34
8.0.120.0000.00816.95
8.0.110.0000.00716.89
8.0.100.0070.00016.91
8.0.90.0000.00816.93
8.0.80.0040.01217.02
8.0.70.0040.00416.96
8.0.60.0090.00017.02
8.0.50.0000.00817.07
8.0.30.0080.01217.10
8.0.20.0090.01117.40
8.0.10.0040.00416.87
8.0.00.0110.00816.60
7.4.330.0020.00215.00
7.4.320.0000.00716.52
7.4.300.0030.00316.52
7.4.290.0040.00416.55
7.4.280.0030.00516.49
7.4.270.0030.00316.39
7.4.260.0030.00316.51
7.4.250.0030.00516.33
7.4.240.0030.00516.50
7.4.230.0040.00416.63
7.4.220.0100.01316.47
7.4.210.0080.00716.49
7.4.200.0080.00016.58
7.4.190.0020.00516.51
7.4.160.0060.00916.63
7.4.150.0100.00717.40
7.4.140.0080.00917.86
7.4.130.0080.01016.42
7.4.120.0130.00816.43
7.4.110.0150.00316.38
7.4.100.0090.00916.43
7.4.90.0100.00616.55
7.4.80.0120.00819.39
7.4.70.0060.01216.67
7.4.60.0150.00916.53
7.4.50.0000.00816.37
7.4.40.0030.01022.77
7.4.30.0030.01216.52
7.4.00.0070.01014.59
7.3.330.0000.00513.43
7.3.320.0000.00513.21
7.3.310.0040.00416.21
7.3.300.0040.00416.30
7.3.290.0100.00916.49
7.3.280.0080.00916.33
7.3.270.0090.01217.40
7.3.260.0140.00316.43
7.3.250.0110.00616.54
7.3.240.0060.01216.43
7.3.230.0100.01316.39
7.3.210.0150.00616.42
7.3.200.0100.01319.39
7.3.190.0140.00616.61
7.3.180.0080.00816.56
7.3.170.0070.01116.53
7.3.160.0100.00716.48
7.3.120.0110.00414.71
7.2.330.0090.00916.44
7.2.320.0100.00616.21
7.2.310.0110.00616.52
7.2.300.0100.00616.30
7.2.290.0000.01616.40
7.2.60.0040.01016.95
7.2.00.0030.01419.37
7.1.200.0060.00315.47
7.1.100.0000.01117.99
7.1.70.0040.00417.01
7.1.60.0150.00319.46
7.1.50.0160.01016.81
7.1.00.0100.07022.33
7.0.200.0060.01016.64
7.0.140.0030.07021.95
7.0.60.0100.07720.01
7.0.50.0100.08017.97
7.0.40.0130.06720.11
7.0.30.0300.03720.10
7.0.20.0270.04320.17
7.0.10.0130.08320.10
7.0.00.0100.03720.23
5.6.210.0130.04720.65
5.6.200.0070.08318.16
5.6.190.0030.05720.47
5.6.180.0300.06320.50
5.6.170.0200.03720.46
5.6.160.0100.08720.44
5.6.150.0130.04018.21
5.6.140.0070.04018.24
5.6.130.0070.08018.18
5.6.120.0170.06720.98
5.6.110.0130.08021.02
5.6.100.0170.07321.01
5.6.90.0070.04320.98
5.6.80.0100.07720.51
5.6.70.4130.04320.53
5.5.350.0330.06720.41
5.5.340.0100.07718.01
5.5.330.0030.04320.30
5.5.320.0400.07320.51
5.5.310.0270.07720.36
5.5.300.0070.05717.93
5.5.290.0170.05717.95
5.5.280.0030.08720.80
5.5.270.0130.07720.73
5.5.260.0070.08020.87
5.5.250.0100.04320.51
5.5.240.0370.05320.13
5.4.450.0400.03719.27
5.4.440.0270.05319.46
5.4.430.0330.05319.31
5.4.420.0270.06319.57
5.4.410.0270.06319.44
5.4.400.0370.06318.85
5.4.390.0300.07019.15
5.4.380.0300.06319.07
5.4.370.0370.06019.09
5.4.360.0400.06019.09
5.4.350.0370.06319.22
5.4.340.0230.05018.99
5.4.320.0300.06719.16
5.4.310.0430.06019.22
5.4.300.0300.03718.98
5.4.290.0200.06719.15
5.4.280.0270.04019.24
5.4.270.0300.03318.87
5.4.260.0370.06719.14
5.4.250.0370.03719.09
5.4.240.0270.07719.19
5.4.230.0300.07719.31
5.4.220.0200.04019.21
5.4.210.0430.03019.30
5.4.200.0270.05019.13
5.4.190.0270.07019.14
5.4.180.0300.03019.21
5.4.170.0330.05718.93
5.4.160.0200.05319.12
5.4.150.0270.07719.25
5.4.140.0230.05016.39
5.4.130.0300.06316.40
5.4.120.0270.05716.32
5.4.110.0230.07316.60
5.4.100.0370.03716.50
5.4.90.0400.06316.50
5.4.80.0330.06316.57
5.4.70.0300.04316.60
5.4.60.0300.04016.51
5.4.50.0370.06716.43
5.4.40.0330.04016.17
5.4.30.0330.07016.38
5.4.20.0230.07016.47
5.4.10.0200.03716.42
5.4.00.0200.04315.80
5.3.290.0330.07014.68
5.3.280.0300.05014.76
5.3.270.0330.04314.70
5.3.260.0330.07014.61
5.3.250.0270.05714.63
5.3.240.0200.04014.58
5.3.230.0270.06714.65
5.3.220.0270.04714.47
5.3.210.0270.07714.64
5.3.200.0300.05014.58
5.3.190.0270.07014.51
5.3.180.0300.06714.57
5.3.170.0330.07014.72
5.3.160.0270.04014.46
5.3.150.0230.03714.73
5.3.140.0370.06314.64
5.3.130.0330.07014.69
5.3.120.0270.04714.46
5.3.110.0130.04714.48
5.3.100.0270.04014.16
5.3.90.0200.03313.95
5.3.80.0200.03713.93
5.3.70.0230.03713.93
5.3.60.0270.06713.91
5.3.50.0270.03313.97
5.3.40.0200.04314.12
5.3.30.0270.07013.82
5.3.20.0230.06713.92
5.3.10.0230.04713.57
5.3.00.0270.05313.62
5.2.170.0230.06311.09
5.2.160.0170.03311.06
5.2.150.0200.05011.12
5.2.140.0300.05311.31
5.2.130.0270.04311.07
5.2.120.0230.04711.28
5.2.110.0200.04011.20
5.2.100.0230.05011.05
5.2.90.0270.05711.04
5.2.80.0170.06311.27
5.2.70.0230.06011.03
5.2.60.0270.03711.14
5.2.50.0300.03010.98
5.2.40.0170.03310.91
5.2.30.0130.04010.90
5.2.20.0200.06310.89
5.2.10.0200.04010.77
5.2.00.0170.03710.79
5.1.60.0130.04010.23
5.1.50.0230.02710.16
5.1.40.0230.0479.97
5.1.30.0300.04710.35
5.1.20.0130.03310.27
5.1.10.0230.0439.99
5.1.00.0200.03010.06
5.0.50.0100.0479.88
5.0.40.0130.0309.88
5.0.30.0130.0279.88
5.0.20.0130.0209.88
5.0.10.0130.0439.88
5.0.00.0170.0579.88
4.4.90.0130.0209.88
4.4.80.0130.0139.88
4.4.70.0100.0339.88
4.4.60.0130.0179.88
4.4.50.0130.0309.88
4.4.40.0130.0209.88
4.4.30.0170.0239.88
4.4.20.0100.0339.88
4.4.10.0070.0379.88
4.4.00.0130.0509.88
4.3.110.0130.0179.88
4.3.100.0100.0179.88
4.3.90.0100.0179.88
4.3.80.0170.0439.88
4.3.70.0130.0209.88
4.3.60.0170.0209.88
4.3.50.0070.0279.88
4.3.40.0100.0539.88
4.3.30.0030.0239.88
4.3.20.0030.0179.88
4.3.10.0070.0279.88
4.3.00.0070.0209.88

preferences:
40.76 ms | 400 KiB | 5 Q