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 { } // 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.0150.00318.59
8.3.30.0140.00418.96
8.3.20.0040.00420.31
8.3.10.0040.00422.08
8.3.00.0040.00422.09
8.2.170.0120.00322.96
8.2.160.0140.00320.70
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0050.00226.16
8.2.120.0080.00017.50
8.2.110.0030.00722.16
8.2.100.0080.00319.31
8.2.90.0000.00819.09
8.2.80.0060.00317.97
8.2.70.0030.00717.50
8.2.60.0040.00817.91
8.2.50.0000.00818.07
8.2.40.0030.00618.09
8.2.30.0000.00717.99
8.2.20.0040.00417.65
8.2.10.0040.00417.75
8.2.00.0040.00417.66
8.1.270.0050.00322.20
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00623.96
8.1.230.0070.00719.03
8.1.220.0070.00017.74
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0080.00017.40
8.1.180.0040.00418.10
8.1.170.0000.01018.49
8.1.160.0000.00721.94
8.1.150.0000.00718.53
8.1.140.0040.00417.30
8.1.130.0000.00717.73
8.1.120.0050.00217.29
8.1.110.0040.00317.41
8.1.100.0070.00017.38
8.1.90.0000.00717.41
8.1.80.0070.00017.45
8.1.70.0030.00317.34
8.1.60.0030.00617.59
8.1.50.0030.00517.44
8.1.40.0000.00717.35
8.1.30.0040.00417.51
8.1.20.0000.00817.41
8.1.10.0050.00217.29
8.1.00.0040.00417.30
8.0.300.0030.00318.77
8.0.290.0000.00717.16
8.0.280.0030.00318.37
8.0.270.0030.00317.20
8.0.260.0000.00616.82
8.0.250.0040.00416.93
8.0.240.0000.00716.98
8.0.230.0000.00716.81
8.0.220.0030.00316.93
8.0.210.0040.00416.78
8.0.200.0030.00316.99
8.0.190.0000.00716.86
8.0.180.0080.00016.90
8.0.170.0020.00516.98
8.0.160.0050.00216.87
8.0.150.0050.00216.88
8.0.140.0000.00716.79
8.0.130.0000.00713.31
8.0.120.0000.00816.68
8.0.110.0000.00716.82
8.0.100.0060.00316.88
8.0.90.0040.00416.95
8.0.80.0070.01016.84
8.0.70.0000.00817.00
8.0.60.0030.00516.79
8.0.50.0040.00416.75
8.0.30.0090.01317.03
8.0.20.0120.00617.40
8.0.10.0030.00317.04
8.0.00.0050.01416.80
7.4.330.0030.00315.06
7.4.320.0060.00016.34
7.4.300.0000.00616.46
7.4.290.0040.00416.39
7.4.280.0000.00716.44
7.4.270.0030.00316.50
7.4.260.0060.00316.45
7.4.250.0040.00416.42
7.4.240.0060.00116.51
7.4.230.0000.00716.65
7.4.220.0110.00616.41
7.4.210.0120.00516.53
7.4.200.0070.00016.64
7.4.190.0030.00516.51
7.4.160.0080.00816.55
7.4.150.0140.00317.40
7.4.140.0090.00917.86
7.4.130.0110.00916.39
7.4.120.0050.01216.50
7.4.110.0170.00016.60
7.4.100.0030.01316.41
7.4.90.0060.01216.32
7.4.80.0100.01419.39
7.4.70.0050.01116.46
7.4.60.0120.00616.46
7.4.50.0000.00816.06
7.4.40.0090.00922.77
7.4.30.0130.01016.27
7.4.00.0030.01414.78
7.3.330.0050.00013.23
7.3.320.0000.00513.09
7.3.310.0050.00316.20
7.3.300.0030.00316.10
7.3.290.0100.00316.18
7.3.280.0090.00716.24
7.3.270.0060.01117.40
7.3.260.0060.01016.27
7.3.250.0070.01016.36
7.3.240.0000.01716.27
7.3.230.0130.00316.42
7.3.210.0080.00816.32
7.3.200.0120.00919.39
7.3.190.0160.00616.31
7.3.180.0130.00716.33
7.3.170.0130.00916.57
7.3.160.0150.00016.25
7.3.120.0120.00314.78
7.2.330.0130.00316.59
7.2.320.0100.01416.55
7.2.310.0040.02016.40
7.2.300.0070.01016.16
7.2.290.0000.01616.53
7.2.80.0060.00616.30
7.2.60.0100.00716.61
7.2.00.0070.00419.14
7.1.200.0030.01015.67
7.1.100.0000.01317.86
7.1.70.0030.00716.92
7.1.60.0130.00619.82
7.1.50.0070.01416.83
7.1.00.0030.07322.25
7.0.200.0000.00716.70
7.0.140.0000.07722.08
7.0.60.0130.07319.82
7.0.50.0130.08017.98
7.0.40.0030.04320.13
7.0.30.0530.06320.24
7.0.20.0200.08020.08
7.0.10.0100.08720.25
7.0.00.0000.04720.26
5.6.280.0070.07020.82
5.6.210.0030.04320.53
5.6.200.0130.06718.19
5.6.190.0130.06320.61
5.6.180.0370.04720.42
5.6.170.0300.06020.54
5.6.160.0100.06020.41
5.6.150.0070.05318.14
5.6.140.0130.08018.27
5.6.130.0070.07318.18
5.6.120.0070.07020.85
5.6.110.0170.07721.00
5.6.100.0230.07020.96
5.6.90.0070.04321.04
5.6.80.0100.07720.38
5.5.350.0070.04320.53
5.5.340.0100.07717.93
5.5.330.0100.05320.29
5.5.320.0200.05320.25
5.5.310.0270.06020.24
5.5.300.0030.07317.98
5.5.290.0100.07317.97
5.5.280.0000.04320.98
5.5.270.0000.05720.86
5.5.260.0030.08320.96
5.5.250.0100.08020.70
5.5.240.0100.04020.14
5.4.450.0430.03719.20
5.4.440.0470.04719.47
5.4.430.0400.06019.43
5.4.420.0470.05019.38
5.4.410.0570.05019.16
5.4.400.0100.07318.84
5.4.390.0030.05718.48
5.4.380.0170.06018.80
5.4.370.0200.06018.71
5.4.360.0230.05018.77
5.4.350.0200.05718.76
5.4.340.0230.05018.75
5.4.320.0030.04012.50
5.4.310.0060.04712.50
5.4.300.0070.03612.51
5.4.290.0070.04412.50
5.4.280.0050.03612.40
5.4.270.0100.05718.92
5.4.260.0100.05018.86
5.4.250.0170.05718.82
5.4.240.0030.06318.92
5.4.230.0100.05319.09
5.4.220.0130.05718.92
5.4.210.0170.05718.83
5.4.200.0130.05018.98
5.4.190.0100.08319.00
5.4.180.0070.05718.85
5.4.170.0130.05018.99
5.4.160.0100.05019.09
5.4.150.0200.04718.97
5.4.140.0070.06316.74
5.4.130.0130.07016.70
5.4.120.0100.06716.65
5.4.110.0030.07316.73
5.4.100.0200.05016.78
5.4.90.0230.05716.71
5.4.80.0100.05716.57
5.4.70.0100.05016.52
5.4.60.0070.07716.41
5.4.50.0070.05016.54
5.4.40.0070.05316.44
5.4.30.0170.04316.59
5.4.20.0030.05716.57
5.4.10.0030.06016.64
5.4.00.0170.06015.96
5.3.290.0060.04712.80
5.3.280.0070.05314.88
5.3.270.0100.07714.90
5.3.260.0070.07314.88
5.3.250.0170.06714.79
5.3.240.0070.08314.88
5.3.230.0130.06014.66
5.3.220.0130.05014.79
5.3.210.0130.06014.85
5.3.200.0130.07014.86
5.3.190.0100.05314.63
5.3.180.0130.06314.83
5.3.170.0230.05314.84
5.3.160.0070.05314.76
5.3.150.0070.05314.75
5.3.140.0170.06314.84
5.3.130.0070.06714.82
5.3.120.0170.05314.73
5.3.110.0070.06014.82
5.3.100.0200.04714.22
5.3.90.0230.04314.31
5.3.80.0100.05014.23
5.3.70.0100.05314.10
5.3.60.0070.06714.17
5.3.50.0130.04314.13
5.3.40.0170.04314.00
5.3.30.0130.04714.17
5.3.20.0030.05313.88
5.3.10.0030.06313.87
5.3.00.0130.07013.50
5.2.170.0130.05011.38
5.2.160.0170.03311.34
5.2.150.0030.04711.14
5.2.140.0130.06011.45
5.2.130.0100.04011.23
5.2.120.0030.04311.31
5.2.110.0070.05711.31
5.2.100.0070.04311.11
5.2.90.0130.04311.41
5.2.80.0170.05011.10
5.2.70.0030.04310.96
5.2.60.0100.04011.12
5.2.50.0070.05011.07
5.2.40.0170.03011.26
5.2.30.0100.04011.03
5.2.20.0100.03711.15
5.2.10.0130.05011.05
5.2.00.0030.04310.79
5.1.60.0130.0339.88
5.1.50.0030.03710.26
5.1.40.0030.03710.27
5.1.30.0130.03010.60
5.1.20.0030.04310.58
5.1.10.0000.04010.34
5.1.00.0100.03010.13
5.0.50.0030.0308.66
5.0.40.0070.0278.60
5.0.30.0100.0378.53
5.0.20.0030.0338.28
5.0.10.0100.0378.17
5.0.00.0100.0408.38
4.4.90.0030.0277.48
4.4.80.0000.0337.48
4.4.70.0000.0307.48
4.4.60.0030.0237.48
4.4.50.0030.0207.48
4.4.40.0000.0377.48
4.4.30.0030.0207.48
4.4.20.0070.0207.48
4.4.10.0100.0177.48
4.4.00.0030.0337.48
4.3.110.0100.0277.48
4.3.100.0030.0307.48
4.3.90.0030.0237.48
4.3.80.0030.0477.42
4.3.70.0100.0277.42
4.3.60.0000.0237.42
4.3.50.0070.0177.42
4.3.40.0100.0377.42
4.3.30.0030.0337.42
4.3.20.0000.0237.42
4.3.10.0000.0237.42
4.3.00.0130.0204.45

preferences:
45.47 ms | 400 KiB | 5 Q