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 { function get(){ } function the(){ } function answer(){ } } // 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.0170.00318.68
8.3.50.0090.01021.08
8.3.40.0100.00718.55
8.3.30.0070.00720.34
8.3.20.0070.00020.22
8.3.10.0040.00421.91
8.3.00.0040.00422.36
8.2.180.0090.00616.50
8.2.170.0170.00322.96
8.2.160.0110.00420.32
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0130.00326.16
8.2.120.0070.00317.93
8.2.110.0030.00622.03
8.2.100.0070.00319.43
8.2.90.0000.00819.18
8.2.80.0040.00419.46
8.2.70.0000.00817.63
8.2.60.0040.00417.93
8.2.50.0000.00918.07
8.2.40.0080.00018.22
8.2.30.0040.00417.95
8.2.20.0000.00817.78
8.2.10.0020.00517.74
8.2.00.0000.00817.65
8.1.280.0060.00925.92
8.1.270.0030.00524.66
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0030.00623.75
8.1.230.0040.00818.88
8.1.220.0030.00617.75
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0040.00417.55
8.1.180.0000.00819.10
8.1.170.0050.00318.58
8.1.160.0060.00322.02
8.1.150.0040.00418.60
8.1.140.0030.00517.36
8.1.130.0030.00317.74
8.1.120.0040.00417.48
8.1.110.0050.00317.50
8.1.100.0000.00817.45
8.1.90.0030.00517.49
8.1.80.0000.00717.37
8.1.70.0000.00717.39
8.1.60.0030.00617.63
8.1.50.0000.00817.52
8.1.40.0000.00717.53
8.1.30.0000.00717.65
8.1.20.0040.00417.55
8.1.10.0050.00217.56
8.1.00.0000.00817.52
8.0.300.0040.00418.77
8.0.290.0000.00817.18
8.0.280.0030.00318.43
8.0.270.0050.00217.30
8.0.260.0040.00416.79
8.0.250.0040.00417.02
8.0.240.0090.00017.05
8.0.230.0020.00516.94
8.0.220.0030.00316.98
8.0.210.0030.00516.96
8.0.200.0060.00016.91
8.0.190.0030.00617.04
8.0.180.0070.00017.04
8.0.170.0040.00417.02
8.0.160.0030.00316.88
8.0.150.0000.00716.86
8.0.140.0040.00416.95
8.0.130.0000.00513.34
8.0.120.0050.00316.91
8.0.110.0000.00716.88
8.0.100.0000.00716.79
8.0.90.0040.00417.02
8.0.80.0150.00616.88
8.0.70.0040.00416.99
8.0.60.0050.00216.89
8.0.50.0000.00717.02
8.0.30.0110.00917.19
8.0.20.0160.00617.40
8.0.10.0040.00416.98
8.0.00.0100.00816.69
7.4.330.0000.00515.00
7.4.320.0000.00716.53
7.4.300.0000.00616.49
7.4.290.0030.00716.49
7.4.280.0000.00816.50
7.4.270.0000.00816.52
7.4.260.0030.00316.58
7.4.250.0000.00816.55
7.4.240.0060.00216.52
7.4.230.0030.00316.58
7.4.220.0110.00616.48
7.4.210.0080.00716.52
7.4.200.0000.00816.71
7.4.190.0000.00716.54
7.4.160.0050.01116.45
7.4.150.0040.01317.40
7.4.140.0070.01217.86
7.4.130.0120.00716.54
7.4.120.0100.00816.48
7.4.110.0100.01516.40
7.4.100.0130.00616.54
7.4.90.0070.01116.61
7.4.80.0100.01319.39
7.4.70.0070.01016.55
7.4.60.0100.00716.39
7.4.50.0060.00316.54
7.4.40.0130.00022.77
7.4.30.0080.00816.64
7.4.00.0060.00914.86
7.3.330.0030.00313.18
7.3.320.0000.00613.43
7.3.310.0000.00716.43
7.3.300.0000.00716.37
7.3.290.0070.00716.41
7.3.280.0080.00716.33
7.3.270.0100.00717.40
7.3.260.0090.00816.41
7.3.250.0060.01316.46
7.3.240.0150.01116.54
7.3.230.0070.01016.39
7.3.210.0180.00616.38
7.3.200.0100.01019.39
7.3.190.0150.00316.52
7.3.180.0000.01616.54
7.3.170.0080.00816.34
7.3.160.0070.01116.44
7.3.120.0060.01014.77
7.2.330.0100.00716.61
7.2.320.0090.00916.71
7.2.310.0040.01216.76
7.2.300.0140.00316.29
7.2.290.0000.01716.59
7.2.60.0000.01516.55
7.2.00.0000.01019.54
7.1.200.0030.00715.64
7.1.100.0060.00918.15
7.1.70.0000.00817.18
7.1.60.0100.01619.43
7.1.50.0110.00716.87
7.1.00.0000.03722.28
7.0.200.0070.00716.64
7.0.140.0000.07721.93
7.0.60.0130.08320.02
7.0.50.0100.05717.86
7.0.40.0170.06020.25
7.0.30.0230.04020.24
7.0.20.0200.08720.10
7.0.10.0170.04320.30
7.0.00.0200.08020.06
5.6.280.0000.07720.91
5.6.210.0100.07320.68
5.6.200.0130.07718.27
5.6.190.0070.06720.57
5.6.180.0230.04320.36
5.6.170.0300.05720.57
5.6.160.0070.04020.50
5.6.150.0070.08718.25
5.6.140.0030.06018.14
5.6.130.0100.04018.18
5.6.120.0000.04321.05
5.6.110.0030.06721.00
5.6.100.0030.08021.12
5.6.90.0170.07021.01
5.6.80.0070.08020.29
5.5.350.0270.07320.43
5.5.340.0000.08718.08
5.5.330.0030.05320.32
5.5.320.0230.04320.41
5.5.310.0230.07720.26
5.5.300.0030.04318.04
5.5.290.0070.07717.96
5.5.280.0070.05320.89
5.5.270.0100.08020.87
5.5.260.0130.08320.80
5.5.250.0130.04020.70
5.5.240.0170.08020.24
5.4.450.0430.05719.34
5.4.440.0300.06319.37
5.4.430.0230.05319.44
5.4.420.0170.06319.54
5.4.410.0130.05718.69
5.4.400.0300.05718.85
5.4.390.0370.05318.81
5.4.380.0370.04318.79
5.4.370.0200.04718.73
5.4.360.0200.06718.58
5.4.350.0080.03612.03
5.4.340.0070.03712.02
5.4.320.0030.04212.51
5.4.310.0050.03812.51
5.4.300.0040.04212.51
5.4.290.0070.04012.50
5.4.280.0060.03712.40
5.4.270.0070.04612.40
5.4.260.0070.05812.40
5.4.250.0170.06318.79
5.4.240.0100.05018.79
5.4.230.0100.04718.74
5.4.220.0200.06018.94
5.4.210.0070.05319.09
5.4.200.0100.05718.94
5.4.190.0070.07718.73
5.4.180.0130.04319.09
5.4.170.0070.06318.78
5.4.160.0030.05719.01
5.4.150.0230.06018.98
5.4.140.0130.05316.61
5.4.130.0030.05016.52
5.4.120.0130.05716.47
5.4.110.0130.05316.63
5.4.100.0070.05316.43
5.4.90.0030.05316.59
5.4.80.0130.05316.53
5.4.70.0170.05316.42
5.4.60.0100.04716.56
5.4.50.0070.04716.62
5.4.40.0030.05016.68
5.4.30.0030.05016.52
5.4.20.0100.05316.32
5.4.10.0070.05316.32
5.4.00.0030.05315.99
5.3.290.0060.04412.80
5.3.280.0200.06714.57
5.3.270.0200.06014.70
5.3.260.0070.05314.83
5.3.250.0170.05314.60
5.3.240.0070.05014.60
5.3.230.0100.07014.78
5.3.220.0130.04714.57
5.3.210.0170.05714.66
5.3.200.0130.06014.55
5.3.190.0130.06714.75
5.3.180.0030.06314.39
5.3.170.0070.07314.64
5.3.160.0130.06714.55
5.3.150.0100.06314.58
5.3.140.0100.05014.63
5.3.130.0070.06714.64
5.3.120.0070.08014.64
5.3.110.0130.06714.71
5.3.100.0030.05714.21
5.3.90.0070.05314.00
5.3.80.0000.05713.85
5.3.70.0130.04713.99
5.3.60.0100.04713.83
5.3.50.0000.05313.96
5.3.40.0100.04713.95
5.3.30.0130.04713.99
5.3.20.0030.05013.70
5.3.10.0100.04713.72
5.3.00.0130.04313.66
5.2.170.0070.04011.32
5.2.160.0030.06311.05
5.2.150.0070.04311.22
5.2.140.0070.04311.37
5.2.130.0030.04311.17
5.2.120.0030.04311.07
5.2.110.0030.04011.09
5.2.100.0000.04311.10
5.2.90.0030.04011.19
5.2.80.0030.05011.26
5.2.70.0030.04311.11
5.2.60.0070.03711.28
5.2.50.0070.04011.03
5.2.40.0070.04011.09
5.2.30.0030.05711.04
5.2.20.0070.06010.96
5.2.10.0070.03710.95
5.2.00.0170.04710.72
5.1.60.0030.03310.16
5.1.50.0030.03710.16
5.1.40.0100.0679.96
5.1.30.0030.05010.25
5.1.20.0070.04310.20
5.1.10.0070.03310.11
5.1.00.0100.03010.03
5.0.50.0030.0338.40
5.0.40.0000.0308.44
5.0.30.0030.0438.33
5.0.20.0070.0208.30
5.0.10.0000.0338.23
5.0.00.0030.0438.37
4.4.90.0070.0177.38
4.4.80.0000.0237.38
4.4.70.0100.0137.38
4.4.60.0100.0137.38
4.4.50.0030.0207.38
4.4.40.0030.0437.38
4.4.30.0000.0307.38
4.4.20.0130.0107.38
4.4.10.0030.0237.38
4.4.00.0130.0377.38
4.3.110.0030.0207.38
4.3.100.0030.0207.38
4.3.90.0030.0177.38
4.3.80.0000.0407.38
4.3.70.0070.0137.38
4.3.60.0030.0207.38
4.3.50.0000.0237.38
4.3.40.0070.0307.38
4.3.30.0030.0237.38
4.3.20.0000.0307.38
4.3.10.0070.0137.38
4.3.00.0000.0236.88

preferences:
50.43 ms | 401 KiB | 5 Q