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 { public function get() { return new Answer;} public function the() { return new Answer;} public function answer() { return 4;} } // 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.60.0060.01218.30
8.3.50.0100.00722.06
8.3.40.0040.01118.67
8.3.30.0060.00819.09
8.3.20.0080.00020.34
8.3.10.0000.00822.09
8.3.00.0030.00522.39
8.2.180.0070.01116.75
8.2.170.0140.00422.96
8.2.160.0120.00321.00
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0000.00726.16
8.2.120.0080.00019.36
8.2.110.0060.00320.98
8.2.100.0110.00517.78
8.2.90.0040.00419.22
8.2.80.0050.00317.97
8.2.70.0000.00917.75
8.2.60.0080.00017.80
8.2.50.0060.00318.10
8.2.40.0050.00318.22
8.2.30.0080.00018.01
8.2.20.0040.00417.57
8.2.10.0000.00717.69
8.2.00.0000.00717.66
8.1.280.0070.00725.92
8.1.270.0030.00522.01
8.1.260.0050.00326.35
8.1.250.0000.00828.09
8.1.240.0070.00322.80
8.1.230.0070.00317.64
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0030.00617.35
8.1.190.0000.00817.23
8.1.180.0050.00318.10
8.1.170.0040.00418.61
8.1.160.0000.00721.97
8.1.150.0040.00418.59
8.1.140.0070.00017.39
8.1.130.0000.00917.88
8.1.120.0000.00717.44
8.1.110.0040.00417.27
8.1.100.0030.00617.34
8.1.90.0040.00417.34
8.1.80.0020.00517.45
8.1.70.0000.00717.29
8.1.60.0040.00717.54
8.1.50.0030.00517.52
8.1.40.0000.00817.43
8.1.30.0040.00417.52
8.1.20.0050.00317.70
8.1.10.0040.00417.61
8.1.00.0040.00417.50
8.0.300.0000.00718.77
8.0.290.0030.00616.75
8.0.280.0030.00318.48
8.0.270.0000.00817.30
8.0.260.0000.00616.71
8.0.250.0040.00416.99
8.0.240.0030.00317.04
8.0.230.0030.00316.89
8.0.220.0000.00716.78
8.0.210.0000.00716.90
8.0.200.0000.00616.94
8.0.190.0000.00716.85
8.0.180.0040.00416.82
8.0.170.0020.00516.82
8.0.160.0040.00417.00
8.0.150.0000.00716.88
8.0.140.0050.00316.80
8.0.130.0000.00613.44
8.0.120.0000.00816.92
8.0.110.0070.00016.73
8.0.100.0040.00416.94
8.0.90.0000.00716.89
8.0.80.0040.01216.95
8.0.70.0000.00816.94
8.0.60.0000.00716.91
8.0.50.0040.00416.91
8.0.30.0100.00917.10
8.0.20.0110.00817.40
8.0.10.0040.00416.90
8.0.00.0120.00616.83
7.4.330.0000.00515.00
7.4.320.0000.00616.48
7.4.300.0030.00316.60
7.4.290.0000.00716.63
7.4.280.0030.00316.63
7.4.270.0070.00016.65
7.4.260.0070.00316.61
7.4.250.0080.00016.48
7.4.240.0030.00416.58
7.4.230.0030.00316.43
7.4.220.0070.01016.61
7.4.210.0060.01216.65
7.4.200.0030.00316.37
7.4.190.0040.00416.59
7.4.160.0030.01516.59
7.4.150.0080.01617.40
7.4.140.0120.00817.86
7.4.130.0160.00316.56
7.4.120.0080.00916.59
7.4.110.0100.00616.61
7.4.100.0130.00616.66
7.4.90.0280.01616.41
7.4.80.0060.01619.39
7.4.70.0100.00616.39
7.4.60.0090.00616.54
7.4.50.0040.00416.13
7.4.40.0060.00822.77
7.4.30.0030.01316.49
7.4.00.0040.01115.09
7.3.330.0070.00013.19
7.3.320.0020.00213.22
7.3.310.0000.00716.47
7.3.300.0030.00316.24
7.3.290.0040.01116.29
7.3.280.0080.01016.33
7.3.270.0120.00617.40
7.3.260.0100.00616.57
7.3.250.0100.01016.38
7.3.240.0080.01116.32
7.3.230.0100.01016.39
7.3.210.0090.01216.26
7.3.200.0120.00919.39
7.3.190.0150.00616.38
7.3.180.0130.00316.50
7.3.170.0090.01316.61
7.3.160.0090.01216.32
7.3.120.0140.00314.99
7.3.110.0090.00914.76
7.3.100.0100.00314.88
7.3.90.0030.00614.74
7.3.80.0000.01514.98
7.3.70.0060.00914.66
7.3.60.0060.01214.63
7.3.50.0060.00914.77
7.3.40.0000.01114.64
7.3.30.0130.00314.99
7.3.20.0070.00316.50
7.3.10.0080.00716.51
7.3.00.0030.01316.41
7.2.330.0060.01516.64
7.2.320.0080.01516.60
7.2.310.0140.00916.71
7.2.300.0080.00816.61
7.2.290.0030.01516.53
7.2.250.0030.01714.90
7.2.240.0100.00615.13
7.2.230.0030.01014.95
7.2.220.0030.00615.14
7.2.210.0030.01014.98
7.2.200.0030.01215.02
7.2.190.0030.01014.73
7.2.180.0030.01214.86
7.2.170.0000.01214.79
7.2.130.0030.01416.91
7.2.120.0070.00416.83
7.2.110.0030.00916.61
7.2.100.0030.01316.51
7.2.90.0030.01016.84
7.2.80.0070.00516.56
7.2.70.0040.00816.82
7.2.60.0090.00716.76
7.2.50.0030.01317.02
7.2.40.0030.01316.45
7.2.30.0080.00416.93
7.2.20.0070.01116.80
7.2.10.0000.01216.68
7.2.00.0080.00917.96
7.1.330.0120.00015.68
7.1.320.0040.00815.41
7.1.310.0080.00415.39
7.1.300.0000.01215.38
7.1.290.0060.00615.54
7.1.280.0030.01015.54
7.1.270.0000.01015.54
7.1.260.0000.01415.62
7.1.250.0000.01115.39
7.1.200.0040.00815.72
7.1.100.0030.01017.73
7.1.70.0090.00316.93
7.1.60.0090.00919.82
7.1.50.0140.01016.93
7.1.00.0000.08022.31
7.0.200.0030.00716.83
7.0.140.0000.07722.21
7.0.100.0200.06719.91
7.0.90.0230.07320.00
7.0.80.0170.04019.90
7.0.70.0130.03319.95
7.0.60.0070.03719.96
7.0.50.0100.04020.31
7.0.40.0030.04720.14
7.0.30.0030.04320.06
7.0.20.0100.08019.96
7.0.10.0100.03720.12
7.0.00.0030.04320.17
5.6.280.0000.07721.00
5.6.250.0170.07320.71
5.6.240.0100.07720.68
5.6.230.0130.03720.68
5.6.220.0100.07020.67
5.6.210.0100.03720.50
5.6.200.0130.07321.16
5.6.190.0100.03721.12
5.6.180.0030.04021.07
5.6.170.0030.04020.97
5.6.160.0030.04321.10
5.6.150.0030.04321.18
5.6.140.0130.04021.12
5.6.130.0100.03721.03
5.6.120.0000.04721.11
5.6.110.0030.06721.00
5.6.100.0070.03721.04
5.6.90.0030.04321.13
5.6.80.0070.03720.31
5.6.70.0030.04720.42
5.6.60.0070.03720.55
5.6.50.0030.04320.57
5.6.40.0100.04020.43
5.6.30.0000.04020.38
5.6.20.0000.04320.43
5.6.10.0000.04320.38
5.6.00.0030.05720.41
5.5.380.0170.07020.46
5.5.370.0030.04020.46
5.5.360.0170.05720.42
5.5.350.0030.04320.36
5.5.340.0030.05720.90
5.5.330.0070.04720.90
5.5.320.0000.04320.90
5.5.310.0070.04020.85
5.5.300.0030.04320.93
5.5.290.0030.04020.79
5.5.280.0030.05020.85
5.5.270.0030.04320.88
5.5.260.0000.05020.69
5.5.250.0030.04320.71
5.5.240.0030.04020.27
5.5.230.0070.03720.31
5.5.220.0030.04720.27
5.5.210.0000.04720.10
5.5.200.0130.03020.16
5.5.190.0070.04020.16
5.5.180.0000.04320.24
5.5.160.0100.07720.00
5.5.150.0130.05720.27
5.5.140.0030.08020.09
5.5.130.0130.06320.09
5.5.120.0130.06720.24
5.5.110.0070.03720.23
5.5.100.0100.07320.17
5.5.90.0070.07720.14
5.5.80.0100.06020.09
5.5.70.0030.06020.00
5.5.60.0100.08720.09
5.5.50.0030.07020.17
5.5.40.0100.04020.04
5.5.30.0030.06720.12
5.5.20.0100.06020.07
5.5.10.0030.08019.99
5.5.00.0100.08020.13
5.4.450.0030.04019.48
5.4.440.0070.03719.54
5.4.430.0030.04019.35
5.4.420.0030.04019.41
5.4.410.0130.05319.07
5.4.400.0000.03719.22
5.4.390.0100.07019.18
5.4.380.0000.04019.04
5.4.370.0000.04019.14
5.4.360.0000.04018.88
5.4.350.0030.04019.13
5.4.340.0070.03718.88
5.4.320.0070.07319.04
5.4.310.0100.07019.15
5.4.300.0100.07318.89
5.4.290.0070.07719.03
5.4.280.0100.04318.91
5.4.270.0100.06319.23
5.4.260.0100.06718.88
5.4.250.0130.06718.88
5.4.240.0030.06719.23
5.4.230.0030.07718.84
5.4.220.0170.03719.13
5.4.210.0070.05319.18
5.4.200.0070.08019.02
5.4.190.0100.07318.89
5.4.180.0100.04018.84
5.4.170.0100.07319.22
5.4.160.0100.04718.88
5.4.150.0030.07719.16
5.4.140.0100.06316.50
5.4.130.0100.06016.55
5.4.120.0070.07016.52
5.4.110.0130.04016.57
5.4.100.0070.04716.49
5.4.90.0130.06316.48
5.4.80.0070.06716.51
5.4.70.0070.06316.38
5.4.60.0070.07716.40
5.4.50.0130.06716.27
5.4.40.0100.05716.36
5.4.30.0100.06716.32
5.4.20.0030.06716.46
5.4.10.0100.07016.36
5.4.00.0030.08015.88
5.3.290.0070.07314.79
5.3.280.0070.07314.67
5.3.270.0070.05714.67
5.3.260.0000.08014.70
5.3.250.0030.07014.59
5.3.240.0030.07714.59
5.3.230.0100.07314.61
5.3.220.0100.07014.69
5.3.210.0000.05714.59
5.3.200.0070.07014.56
5.3.190.0070.06714.53
5.3.180.0030.07314.64
5.3.170.0130.06314.52
5.3.160.0030.06714.68
5.3.150.0000.07714.57
5.3.140.0170.06014.50
5.3.130.0070.07314.51
5.3.120.0100.07314.54
5.3.110.0130.07014.54
5.3.100.0100.04714.18
5.3.90.0070.07714.17
5.3.80.0100.07014.09
5.3.70.0070.07714.09
5.3.60.0070.04714.08
5.3.50.0000.07713.94
5.3.40.0130.06313.98
5.3.30.0230.03313.84
5.3.20.0100.06713.75
5.3.10.0100.07013.75
5.3.00.0100.08013.63
5.2.170.0100.06711.04
5.2.160.0000.06711.04
5.2.150.0070.06011.28
5.2.140.0070.05711.27
5.2.130.0030.03311.14
5.2.120.0100.06011.14
5.2.110.0130.04711.10
5.2.100.0100.05711.18
5.2.90.0030.05311.14
5.2.80.0000.06711.10
5.2.70.0130.05311.11
5.2.60.0170.05311.09
5.2.50.0030.06711.11
5.2.40.0070.04010.94
5.2.30.0070.06010.92
5.2.20.0070.05711.04
5.2.10.0070.06010.94
5.2.00.0030.06710.76
5.1.60.0070.0439.89
5.1.50.0030.0609.84
5.1.40.0030.04010.07
5.1.30.0030.03710.48
5.1.20.0200.04310.35
5.1.10.0030.04010.13
5.1.00.0070.05310.15
5.0.50.0070.0438.55
5.0.40.0000.0438.49
5.0.30.0100.0608.33
5.0.20.0000.0478.21
5.0.10.0030.0438.13
5.0.00.0070.0608.26
4.4.90.0000.0378.13
4.4.80.0100.0278.13
4.4.70.0030.0408.13
4.4.60.0000.0338.13
4.4.50.0130.0238.13
4.4.40.0000.0578.13
4.4.30.0030.0338.13
4.4.20.0000.0378.13
4.4.10.0030.0338.13
4.4.00.0070.0508.13
4.3.110.0000.0278.13
4.3.100.0000.0378.13
4.3.90.0030.0378.13
4.3.80.0030.0578.13
4.3.70.0000.0338.13
4.3.60.0070.0338.13
4.3.50.0000.0378.13
4.3.40.0030.0438.13
4.3.30.0000.0338.13
4.3.20.0070.0238.13
4.3.10.0030.0308.13
4.3.00.0000.0378.13

preferences:
50.13 ms | 401 KiB | 5 Q