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() { 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.0070.01318.25
8.3.50.0170.01421.93
8.3.40.0110.00418.70
8.3.30.0070.01119.23
8.3.20.0070.00020.16
8.3.10.0080.00022.09
8.3.00.0070.00022.39
8.2.180.0220.00016.75
8.2.170.0150.00022.96
8.2.160.0100.00720.94
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0120.00426.16
8.2.120.0050.00317.50
8.2.110.0060.00321.95
8.2.100.0030.01017.72
8.2.90.0030.00619.17
8.2.80.0040.00418.04
8.2.70.0080.00017.63
8.2.60.0040.00418.05
8.2.50.0000.00818.07
8.2.40.0070.00318.22
8.2.30.0000.00718.13
8.2.20.0030.00517.64
8.2.10.0000.00717.70
8.2.00.0040.00417.71
8.1.280.0100.01025.92
8.1.270.0060.00321.88
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0150.00023.91
8.1.230.0060.00619.10
8.1.220.0030.00617.78
8.1.210.0040.00418.77
8.1.200.0080.00017.25
8.1.190.0040.00417.41
8.1.180.0060.00318.10
8.1.170.0030.00618.59
8.1.160.0000.00822.07
8.1.150.0000.00718.70
8.1.140.0000.00717.46
8.1.130.0040.00417.79
8.1.120.0030.00317.30
8.1.110.0070.00017.35
8.1.100.0020.00517.43
8.1.90.0040.00417.33
8.1.80.0000.00717.31
8.1.70.0080.00017.35
8.1.60.0000.00917.60
8.1.50.0000.00817.49
8.1.40.0000.00717.50
8.1.30.0000.00717.55
8.1.20.0040.00417.48
8.1.10.0040.00417.44
8.1.00.0000.00817.52
8.0.300.0030.00318.77
8.0.290.0070.00017.16
8.0.280.0030.00318.37
8.0.270.0030.00317.25
8.0.260.0000.00816.93
8.0.250.0030.00317.01
8.0.240.0040.00416.93
8.0.230.0030.00316.93
8.0.220.0000.00716.92
8.0.210.0000.00716.90
8.0.200.0030.00317.05
8.0.190.0080.00017.04
8.0.180.0030.00716.91
8.0.170.0000.00716.86
8.0.160.0000.00816.99
8.0.150.0000.00816.87
8.0.140.0040.00416.82
8.0.130.0000.00613.42
8.0.120.0040.00416.80
8.0.110.0030.00516.96
8.0.100.0000.00816.97
8.0.90.0050.00216.98
8.0.80.0100.00716.91
8.0.70.0080.00016.86
8.0.60.0030.00416.76
8.0.50.0040.00416.97
8.0.30.0130.00716.86
8.0.20.0150.00717.41
8.0.10.0040.00417.07
8.0.00.0090.01216.87
7.4.330.0000.00515.00
7.4.320.0000.01016.64
7.4.300.0030.00316.45
7.4.290.0000.00716.41
7.4.280.0040.00416.51
7.4.270.0070.00016.56
7.4.260.0090.00016.45
7.4.250.0000.00716.52
7.4.240.0030.00516.51
7.4.230.0040.00416.63
7.4.220.0110.00716.63
7.4.210.0100.00616.60
7.4.200.0050.00516.68
7.4.190.0070.00016.42
7.4.160.0110.00716.35
7.4.150.0110.00717.40
7.4.140.0110.00917.86
7.4.130.0070.01316.55
7.4.120.0070.01016.66
7.4.110.0070.01016.54
7.4.100.0110.00516.63
7.4.90.0130.01016.66
7.4.80.0100.01319.39
7.4.70.0000.01716.64
7.4.60.0030.01316.47
7.4.50.0030.00516.39
7.4.40.0070.01122.77
7.4.30.0120.00416.50
7.4.00.0000.01714.87
7.3.330.0030.00313.36
7.3.320.0060.00013.17
7.3.310.0000.00716.40
7.3.300.0060.00016.37
7.3.290.0090.01016.33
7.3.280.0090.01016.37
7.3.270.0130.00317.40
7.3.260.0100.00716.45
7.3.250.0120.00516.48
7.3.240.0170.00016.53
7.3.230.0060.01316.42
7.3.210.0180.00016.52
7.3.200.0140.00619.39
7.3.190.0120.00916.35
7.3.180.0030.01216.58
7.3.170.0130.00916.65
7.3.160.0100.00716.46
7.3.120.0070.00714.86
7.3.110.0070.00714.55
7.3.100.0040.00714.73
7.3.90.0040.01514.73
7.3.80.0070.00314.80
7.3.70.0090.00614.75
7.3.60.0070.00414.86
7.3.50.0000.00914.58
7.3.40.0060.00614.88
7.3.30.0120.00014.83
7.3.20.0080.00416.65
7.3.10.0040.01016.70
7.3.00.0020.01016.62
7.2.330.0110.00816.64
7.2.320.0100.00716.61
7.2.310.0110.01116.66
7.2.300.0130.00316.54
7.2.290.0050.01116.79
7.2.240.0080.00815.25
7.2.230.0060.00315.16
7.2.220.0030.01214.90
7.2.210.0100.00715.04
7.2.200.0000.01715.07
7.2.190.0030.01215.05
7.2.180.0180.00014.98
7.2.170.0000.01814.78
7.2.160.0030.01314.73
7.2.150.0040.01516.86
7.2.140.0040.00716.73
7.2.130.0020.01216.95
7.2.120.0100.00316.85
7.2.110.0050.00916.90
7.2.100.0030.01016.91
7.2.90.0100.00516.79
7.2.80.0100.00516.80
7.2.70.0100.00616.54
7.2.60.0070.00616.81
7.2.50.0080.00616.81
7.2.40.0090.00716.96
7.2.30.0070.00816.76
7.2.20.0060.00616.70
7.2.10.0030.01016.88
7.2.00.0070.01117.63
7.1.330.0070.00415.64
7.1.320.0030.01415.55
7.1.310.0040.01415.82
7.1.300.0070.00315.71
7.1.290.0030.01015.81
7.1.280.0000.01515.84
7.1.270.0000.01615.37
7.1.260.0070.00715.84
7.1.250.0050.00815.91
7.1.200.0040.00815.76
7.1.100.0060.00918.11
7.1.70.0040.01116.82
7.1.60.0030.01319.82
7.1.50.0070.01416.72
7.1.00.0070.07322.33
7.0.200.0030.00616.83
7.0.140.0070.07021.98
7.0.60.0100.06020.03
7.0.50.0070.03717.94
7.0.40.0070.07320.04
7.0.30.0400.04720.11
7.0.20.0370.06020.16
7.0.10.0100.08320.24
7.0.00.0030.09320.02
5.6.280.0030.07321.03
5.6.210.0100.08320.62
5.6.200.0070.06718.17
5.6.190.0100.03720.39
5.6.180.0470.04320.46
5.6.170.0400.06020.47
5.6.160.0130.07020.61
5.6.150.0070.07318.19
5.6.140.0170.07018.15
5.6.130.0030.06718.19
5.6.120.0030.08320.95
5.6.110.0100.07320.99
5.6.100.0100.08021.03
5.6.90.0100.08721.14
5.6.80.0170.07020.52
5.5.350.0130.04320.41
5.5.340.0100.05017.93
5.5.330.0070.08320.13
5.5.320.0400.07320.27
5.5.310.0170.05020.23
5.5.300.0100.07717.98
5.5.290.0100.06318.06
5.5.280.0070.06720.74
5.5.270.0030.05020.88
5.5.260.0100.07320.80
5.5.250.0100.08020.55
5.5.240.0100.06020.26
5.4.450.0130.03319.57
5.4.440.0430.04319.49
5.4.430.0430.06019.38
5.4.420.0530.05319.48
5.4.410.0600.05719.34
5.4.400.0070.05318.79
5.4.390.0070.05318.76
5.4.380.0370.05318.74
5.4.370.0230.05018.54
5.4.360.0230.04718.71
5.4.350.0170.06018.50
5.4.340.0270.04718.75
5.4.320.0070.03412.50
5.4.310.0070.04512.50
5.4.300.0050.04212.51
5.4.290.0060.03712.51
5.4.280.0080.04312.40
5.4.270.0130.06719.21
5.4.260.0070.06718.86
5.4.250.0170.04719.12
5.4.240.0030.06019.00
5.4.230.0100.06318.93
5.4.220.0230.05018.98
5.4.210.0070.06318.83
5.4.200.0170.05319.00
5.4.190.0070.06318.96
5.4.180.0170.04718.96
5.4.170.0100.05718.99
5.4.160.0200.05719.11
5.4.150.0100.07718.80
5.4.140.0100.05316.67
5.4.130.0170.06316.64
5.4.120.0170.06716.43
5.4.110.0130.05316.73
5.4.100.0130.06316.68
5.4.90.0130.06316.73
5.4.80.0170.06016.71
5.4.70.0230.06316.64
5.4.60.0070.05016.38
5.4.50.0230.05716.50
5.4.40.0200.06716.65
5.4.30.0170.04716.64
5.4.20.0170.05716.65
5.4.10.0230.05316.48
5.4.00.0070.05316.02
5.3.290.0090.03612.80
5.3.280.0130.06714.48
5.3.270.0100.07714.61
5.3.260.0100.07714.73
5.3.250.0130.07014.87
5.3.240.0170.04314.90
5.3.230.0070.06014.84
5.3.220.0100.05014.77
5.3.210.0100.07714.63
5.3.200.0130.05714.57
5.3.190.0170.06714.57
5.3.180.0070.06314.77
5.3.170.0000.06014.88
5.3.160.0130.05014.86
5.3.150.0070.07014.86
5.3.140.0100.06714.69
5.3.130.0070.05714.68
5.3.120.0100.05714.86
5.3.110.0130.05314.62
5.3.100.0170.06714.24
5.3.90.0070.05714.32
5.3.80.0100.07014.29
5.3.70.0070.07714.25
5.3.60.0070.05314.05
5.3.50.0100.06714.13
5.3.40.0130.05013.95
5.3.30.0100.07314.09
5.3.20.0130.06713.92
5.3.10.0100.05013.68
5.3.00.0100.07313.64
5.2.170.0100.06011.44
5.2.160.0070.04311.27
5.2.150.0070.04011.34
5.2.140.0000.05011.20
5.2.130.0000.06311.18
5.2.120.0030.05711.39
5.2.110.0030.06011.11
5.2.100.0130.03711.38
5.2.90.0100.04311.07
5.2.80.0100.05711.29
5.2.70.0100.06011.15
5.2.60.0070.04710.95
5.2.50.0100.04311.06
5.2.40.0100.05311.00
5.2.30.0100.05711.00
5.2.20.0130.05011.27
5.2.10.0200.03311.05
5.2.00.0170.04310.91
5.1.60.0100.03310.21
5.1.50.0100.03010.24
5.1.40.0030.0479.97
5.1.30.0100.04710.55
5.1.20.0100.03010.42
5.1.10.0000.04010.37
5.1.00.0070.03710.10
5.0.50.0070.0308.85
5.0.40.0030.0408.63
5.0.30.0070.0508.45
5.0.20.0170.0208.50
5.0.10.0070.0278.48
5.0.00.0130.0408.40
4.4.90.0070.0277.41
4.4.80.0070.0277.41
4.4.70.0070.0277.41
4.4.60.0100.0207.41
4.4.50.0000.0307.41
4.4.40.0000.0377.41
4.4.30.0030.0207.41
4.4.20.0000.0237.41
4.4.10.0030.0207.41
4.4.00.0130.0377.41
4.3.110.0030.0277.41
4.3.100.0000.0337.41
4.3.90.0030.0307.41
4.3.80.0000.0537.41
4.3.70.0100.0277.41
4.3.60.0030.0237.41
4.3.50.0000.0237.41
4.3.40.0000.0377.41
4.3.30.0070.0207.41
4.3.20.0070.0207.41
4.3.10.0030.0307.41
4.3.00.0000.0234.46

preferences:
40.1 ms | 401 KiB | 5 Q