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 ""; } public function the() { return ""; } 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.70.0150.00016.63
8.3.60.0060.00916.63
8.3.50.0050.01221.96
8.3.40.0000.01418.83
8.3.30.0000.01419.09
8.3.20.0030.00520.02
8.3.10.0050.00323.65
8.3.00.0080.00020.93
8.2.180.0000.01518.29
8.2.170.0110.00422.96
8.2.160.0100.00320.57
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0000.00820.90
8.2.110.0030.00622.20
8.2.100.0130.00017.78
8.2.90.0060.00319.08
8.2.80.0040.00417.97
8.2.70.0080.00017.63
8.2.60.0000.00917.80
8.2.50.0000.00818.07
8.2.40.0030.00619.89
8.2.30.0040.00418.13
8.2.20.0040.00417.86
8.2.10.0040.00417.92
8.2.00.0040.00417.73
8.1.280.0110.00725.92
8.1.270.0050.00322.06
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0040.00423.80
8.1.230.0100.00019.04
8.1.220.0060.00317.74
8.1.210.0040.00418.77
8.1.200.0080.00417.35
8.1.190.0080.00017.23
8.1.180.0000.00818.10
8.1.170.0060.00318.56
8.1.160.0000.00721.98
8.1.150.0070.00018.64
8.1.140.0000.00817.41
8.1.130.0030.00317.83
8.1.120.0020.00517.38
8.1.110.0040.00417.39
8.1.100.0030.00617.42
8.1.90.0000.00717.48
8.1.80.0030.00317.46
8.1.70.0000.00717.40
8.1.60.0040.00417.65
8.1.50.0090.00017.50
8.1.40.0040.00417.57
8.1.30.0040.00417.65
8.1.20.0000.00717.66
8.1.10.0000.00717.48
8.1.00.0000.00717.53
8.0.300.0000.00818.77
8.0.290.0040.00417.15
8.0.280.0030.00318.45
8.0.270.0080.00017.22
8.0.260.0070.00317.14
8.0.250.0000.00717.04
8.0.240.0070.00016.91
8.0.230.0000.00716.87
8.0.220.0070.00016.83
8.0.210.0030.00317.02
8.0.200.0060.00316.98
8.0.190.0000.00817.07
8.0.180.0000.00916.91
8.0.170.0000.00717.04
8.0.160.0000.00716.94
8.0.150.0000.00716.81
8.0.140.0070.00416.89
8.0.130.0050.00313.45
8.0.120.0030.00616.83
8.0.110.0000.00716.99
8.0.100.0030.00516.76
8.0.90.0050.00316.87
8.0.80.0040.01116.97
8.0.70.0050.00316.79
8.0.60.0000.01016.76
8.0.50.0020.00516.82
8.0.30.0090.00917.13
8.0.20.0060.01417.40
8.0.10.0030.00516.94
8.0.00.0060.01016.73
7.4.330.0020.00215.08
7.4.320.0030.00316.41
7.4.300.0000.00916.51
7.4.290.0030.00316.58
7.4.280.0040.00416.51
7.4.270.0000.00816.62
7.4.260.0030.00316.49
7.4.250.0000.00816.62
7.4.240.0040.00316.56
7.4.230.0030.00316.52
7.4.220.0040.01316.56
7.4.210.0100.00616.59
7.4.200.0060.00316.68
7.4.190.0080.00016.76
7.4.160.0120.00616.51
7.4.150.0060.01317.40
7.4.140.0140.00517.86
7.4.130.0070.01116.75
7.4.120.0090.00816.50
7.4.110.0090.00916.57
7.4.100.0090.00916.57
7.4.90.0030.01316.48
7.4.80.0100.01319.39
7.4.70.0090.00816.48
7.4.60.0000.01516.68
7.4.50.0040.00416.32
7.4.40.0120.00916.58
7.4.30.0140.00316.67
7.4.00.0060.01015.13
7.3.330.0000.00513.33
7.3.320.0020.00213.16
7.3.310.0040.00416.36
7.3.300.0040.00416.35
7.3.290.0110.00416.27
7.3.280.0100.01016.34
7.3.270.0120.00417.40
7.3.260.0120.00916.48
7.3.250.0100.00716.27
7.3.240.0110.00716.25
7.3.230.0060.01116.39
7.3.210.0110.00516.44
7.3.200.0120.00919.39
7.3.190.0100.00716.37
7.3.180.0170.00016.40
7.3.170.0060.01616.51
7.3.160.0060.00916.34
7.3.120.0060.00814.69
7.2.330.0000.01816.68
7.2.320.0150.00916.79
7.2.310.0110.00716.67
7.2.300.0080.00916.65
7.2.290.0060.01316.64
7.2.60.0000.01316.66
7.1.200.0100.00315.63
7.1.70.0000.01217.13
7.1.60.0110.01519.46
7.1.50.0070.01316.90
7.1.00.0030.07722.48
7.0.200.0030.00516.84
7.0.140.0200.05721.97
7.0.60.0100.06020.01
7.0.50.0000.06017.95
7.0.40.0070.08020.10
7.0.30.0170.04320.24
7.0.20.0270.08320.30
7.0.10.0100.06720.23
7.0.00.0000.04320.16
5.6.280.0000.07720.88
5.6.210.0070.08020.55
5.6.200.0070.04318.18
5.6.190.0100.03720.63
5.6.180.0030.08320.60
5.6.170.0170.04020.45
5.6.160.0030.06320.55
5.6.150.0070.05018.25
5.6.140.0030.05018.14
5.6.130.0030.06718.15
5.6.120.0130.06321.11
5.6.110.0130.08021.02
5.6.100.0000.06321.04
5.6.90.0100.06720.98
5.6.80.0070.08020.52
5.5.350.0030.08020.45
5.5.340.0030.06317.93
5.5.330.0000.04720.39
5.5.320.0370.07320.41
5.5.310.0400.03720.27
5.5.300.0030.05717.98
5.5.290.0030.04017.95
5.5.280.0100.04020.66
5.5.270.0100.08320.88
5.5.260.0130.06320.89
5.5.250.0070.08720.70
5.5.240.0000.03320.19
5.4.450.0600.05719.71
5.4.440.0700.05719.53
5.4.430.0430.07019.34
5.4.420.0770.04719.59
5.4.410.0600.06019.57
5.4.400.0900.05018.84
5.4.390.0800.05319.15
5.4.380.0370.07318.45
5.4.370.0330.05718.84
5.4.360.0370.06718.55
5.4.350.0330.06018.48
5.4.340.0230.06018.85
5.4.320.0110.03312.51
5.4.310.0050.04512.51
5.4.300.0070.03612.51
5.4.290.0080.03712.50
5.4.280.0070.03512.40
5.4.270.0090.03412.40
5.4.260.0110.05612.40
5.4.250.0100.06012.40
5.4.240.0090.05112.40
5.4.230.0100.05112.39
5.4.220.0090.05112.39
5.4.210.0090.04712.39
5.4.200.0080.05112.39
5.4.190.0070.05612.39
5.4.180.0100.04912.39
5.4.170.0060.05612.40
5.4.160.0100.04712.40
5.4.150.0060.05212.40
5.4.140.0110.05112.08
5.4.130.0100.04712.06
5.4.120.0080.04012.02
5.4.110.0120.03712.02
5.4.100.0060.04212.02
5.4.90.0070.05012.02
5.4.80.0070.04512.02
5.4.70.0040.04012.02
5.4.60.0130.03212.01
5.4.50.0050.04112.02
5.4.40.0070.03812.00
5.4.30.0080.03712.00
5.4.20.0090.03712.00
5.4.10.0080.03812.00
5.4.00.0130.03911.49
5.3.290.0070.04312.80
5.3.280.0050.04612.71
5.3.270.0090.04512.73
5.3.260.0100.04112.72
5.3.250.0110.03612.72
5.3.240.0060.04212.71
5.3.230.0060.04012.71
5.3.220.0120.03312.68
5.3.210.0090.03612.68
5.3.200.0080.03712.68
5.3.190.0040.04612.68
5.3.180.0030.03912.68
5.3.170.0070.03512.67
5.3.160.0080.03512.67
5.3.150.0100.03512.67
5.3.140.0070.04212.66
5.3.130.0060.04412.66
5.3.120.0080.03812.65
5.3.110.0070.05612.66
5.3.100.0100.04912.12
5.3.90.0070.04912.11
5.3.80.0070.03512.11
5.3.70.0040.03712.10
5.3.60.0030.03812.08
5.3.50.0060.03612.03
5.3.40.0040.03812.03
5.3.30.0030.03812.00
5.3.20.0060.03511.78
5.3.10.0080.03411.73
5.3.00.0040.03911.73
5.2.170.0070.0309.23
5.2.160.0060.0329.23
5.2.150.0030.0329.23
5.2.140.0050.0309.22
5.2.130.0050.0299.18
5.2.120.0050.0289.18
5.2.110.0060.0339.20
5.2.100.0120.0349.20
5.2.90.0090.0439.19
5.2.80.0070.0429.19
5.2.70.0080.0539.19
5.2.60.0060.0439.14
5.2.50.0080.0419.11
5.2.40.0050.0409.08
5.2.30.0040.0449.06
5.2.20.0050.0289.05
5.2.10.0030.0428.96
5.2.00.0030.0348.82
5.1.60.0050.0328.10
5.1.50.0060.0358.10
5.1.40.0050.0338.08
5.1.30.0060.0358.43
5.1.20.0050.0268.45
5.1.10.0050.0258.17
5.1.00.0020.0288.17
5.0.50.0030.0216.66
5.0.40.0060.0166.52
5.0.30.0040.0306.33
5.0.20.0020.0216.30
5.0.10.0050.0226.28
5.0.00.0050.0306.27
4.4.90.0040.0154.78
4.4.80.0040.0154.75
4.4.70.0030.0164.75
4.4.60.0030.0164.75
4.4.50.0030.0174.77
4.4.40.0020.0274.70
4.4.30.0030.0164.76
4.4.20.0040.0174.85
4.4.10.0030.0174.85
4.4.00.0050.0244.76
4.3.110.0050.0144.66
4.3.100.0030.0164.66
4.3.90.0040.0144.64
4.3.80.0020.0264.59
4.3.70.0020.0154.63
4.3.60.0050.0224.63
4.3.50.0050.0204.63
4.3.40.0060.0304.54
4.3.30.0040.0203.30
4.3.20.0030.0213.28
4.3.10.0020.0223.24
4.3.00.0170.0236.93

preferences:
55.12 ms | 401 KiB | 5 Q