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() { echo "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.0040.01116.50
8.3.50.0120.00721.99
8.3.40.0120.00318.88
8.3.30.0150.00018.96
8.3.20.0080.00020.33
8.3.10.0040.00423.40
8.3.00.0080.00020.79
8.2.180.0160.00018.41
8.2.170.0150.00022.96
8.2.160.0100.00320.38
8.2.150.0070.00024.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0050.00320.91
8.2.110.0080.00022.20
8.2.100.0120.00019.46
8.2.90.0080.00019.27
8.2.80.0030.00517.97
8.2.70.0030.00717.61
8.2.60.0000.00817.80
8.2.50.0040.00418.07
8.2.40.0000.00819.88
8.2.30.0000.00818.19
8.2.20.0040.00417.62
8.2.10.0050.00317.99
8.2.00.0000.00817.66
8.1.280.0070.00725.92
8.1.270.0040.00423.96
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0040.00422.09
8.1.230.0080.00419.16
8.1.220.0050.00317.74
8.1.210.0080.00018.77
8.1.200.0060.00317.13
8.1.190.0000.00917.23
8.1.180.0000.00918.10
8.1.170.0030.00618.71
8.1.160.0070.00022.11
8.1.150.0050.00218.64
8.1.140.0040.00417.34
8.1.130.0000.00717.74
8.1.120.0050.00217.51
8.1.110.0040.00417.35
8.1.100.0070.00017.45
8.1.90.0040.00417.41
8.1.80.0050.00317.50
8.1.70.0030.00317.41
8.1.60.0030.00617.56
8.1.50.0040.00417.43
8.1.40.0000.00717.56
8.1.30.0030.00517.52
8.1.20.0040.00417.64
8.1.10.0040.00417.51
8.1.00.0000.00817.40
8.0.300.0040.00418.77
8.0.290.0070.00017.18
8.0.280.0030.00318.43
8.0.270.0000.00717.20
8.0.260.0050.00517.26
8.0.250.0070.00017.07
8.0.240.0040.00416.96
8.0.230.0040.00417.03
8.0.220.0040.00416.86
8.0.210.0040.00416.98
8.0.200.0000.00717.01
8.0.190.0000.00816.92
8.0.180.0040.00416.82
8.0.170.0000.00816.93
8.0.160.0050.00216.77
8.0.150.0000.00816.96
8.0.140.0080.00016.94
8.0.130.0000.00613.30
8.0.120.0030.00516.96
8.0.110.0000.00716.87
8.0.100.0030.00517.00
8.0.90.0000.00716.82
8.0.80.0060.01316.98
8.0.70.0040.00416.81
8.0.60.0070.00017.07
8.0.50.0080.00016.82
8.0.30.0070.01317.08
8.0.20.0080.01017.40
8.0.10.0070.00017.14
8.0.00.0050.01517.04
7.4.330.0030.00315.19
7.4.320.0030.00316.52
7.4.300.0080.00016.61
7.4.290.0070.00016.57
7.4.280.0050.00316.50
7.4.270.0000.00716.54
7.4.260.0030.00516.59
7.4.250.0000.00816.56
7.4.240.0030.00416.56
7.4.230.0000.00716.43
7.4.220.0090.01216.61
7.4.210.0050.00916.57
7.4.200.0000.00816.61
7.4.190.0040.00416.38
7.4.160.0000.02116.46
7.4.150.0100.00717.40
7.4.140.0160.00417.86
7.4.130.0060.01216.57
7.4.120.0090.01016.64
7.4.110.0030.01316.49
7.4.100.0100.00716.65
7.4.90.0110.00616.56
7.4.80.0130.00619.39
7.4.70.0070.01016.73
7.4.60.0060.01216.50
7.4.50.0030.00616.63
7.4.40.0130.00416.61
7.4.30.0060.01016.69
7.4.10.0030.01215.27
7.4.00.0100.00714.95
7.3.330.0000.00513.37
7.3.320.0030.00313.36
7.3.310.0000.00816.22
7.3.300.0020.00516.38
7.3.290.0030.01316.43
7.3.280.0120.00816.36
7.3.270.0120.00617.40
7.3.260.0120.01316.23
7.3.250.0120.00916.36
7.3.240.0200.00316.49
7.3.230.0130.00316.39
7.3.210.0030.01616.37
7.3.200.0060.01119.39
7.3.190.0070.01016.55
7.3.180.0110.00416.47
7.3.170.0040.01216.35
7.3.160.0060.00916.59
7.3.130.0040.01114.90
7.3.120.0040.00714.95
7.3.110.0070.01114.70
7.3.100.0150.00014.57
7.3.90.0040.01215.07
7.3.80.0070.00714.81
7.3.70.0130.00314.91
7.3.60.0080.01114.62
7.3.50.0000.01214.78
7.3.40.0120.00614.59
7.3.30.0120.00314.73
7.3.20.0030.01216.46
7.3.10.0070.00716.47
7.3.00.0060.00316.41
7.2.330.0040.01516.55
7.2.320.0110.00716.67
7.2.310.0110.01116.46
7.2.300.0090.00916.65
7.2.290.0130.01016.64
7.2.260.0150.00315.24
7.2.250.0070.01115.18
7.2.240.0060.00614.87
7.2.230.0030.01715.16
7.2.220.0000.02015.11
7.2.210.0030.01215.03
7.2.200.0040.01415.03
7.2.190.0070.00614.93
7.2.180.0100.01014.78
7.2.170.0060.00614.88
7.2.160.0060.00814.65
7.2.150.0030.00916.90
7.2.140.0030.01016.98
7.2.130.0060.00916.95
7.2.120.0040.00816.64
7.2.110.0120.00017.00
7.2.100.0060.00616.85
7.2.90.0040.01116.84
7.2.80.0040.01116.75
7.2.70.0130.00316.65
7.2.60.0050.01116.74
7.2.50.0030.00716.87
7.2.40.0070.01017.02
7.2.30.0040.00816.86
7.2.20.0030.01016.64
7.2.10.0130.00316.91
7.2.00.0030.00918.11
7.1.330.0000.00915.48
7.1.320.0030.01015.69
7.1.310.0090.00315.84
7.1.300.0040.01515.74
7.1.290.0090.00915.53
7.1.280.0080.00015.90
7.1.270.0060.00915.77
7.1.260.0060.00315.73
7.1.250.0030.01215.77
7.1.240.0030.00715.72
7.1.230.0080.00415.77
7.1.220.0060.00615.62
7.1.210.0040.01115.72
7.1.200.0060.00515.64
7.1.190.0080.00815.84
7.1.180.0000.00915.77
7.1.170.0100.00415.88
7.1.160.0040.00815.89
7.1.150.0040.01115.70
7.1.140.0070.00715.77
7.1.130.0090.00315.77
7.1.120.0070.01015.68
7.1.110.0070.00715.85
7.1.100.0100.00516.85
7.1.90.0070.00715.85
7.1.80.0000.01315.67
7.1.70.0050.00516.39
7.1.60.0110.00617.63
7.1.50.0090.00616.28
7.1.40.0080.00815.78
7.1.30.0060.00315.77
7.1.20.0100.00315.82
7.1.10.0080.00415.82
7.1.00.0050.04019.19
7.0.330.0070.00315.18
7.0.320.0070.00315.43
7.0.310.0060.00615.33
7.0.300.0030.00915.49
7.0.290.0080.00015.31
7.0.280.0030.00715.15
7.0.270.0000.01515.15
7.0.260.0110.00415.29
7.0.250.0030.01515.27
7.0.240.0050.00515.54
7.0.230.0000.00915.60
7.0.220.0060.01015.40
7.0.210.0030.01015.55
7.0.200.0070.00216.04
7.0.190.0030.00915.34
7.0.180.0040.01115.59
7.0.170.0030.01015.25
7.0.160.0030.01015.32
7.0.150.0070.00415.40
7.0.140.0000.04518.76
7.0.130.0030.00615.36
7.0.120.0030.01015.29
7.0.110.0000.00815.50
7.0.100.0060.00615.36
7.0.90.0060.00615.35
7.0.80.0110.00315.19
7.0.70.0050.00315.31
7.0.60.0020.02818.52
7.0.50.0090.04116.64
7.0.40.0050.03016.77
7.0.30.0300.03316.87
7.0.20.0160.02916.77
7.0.10.0080.02316.85
7.0.00.0070.04316.82
5.6.400.0050.00314.32
5.6.390.0100.00314.09
5.6.380.0050.00314.56
5.6.370.0160.00014.52
5.6.360.0000.01514.47
5.6.350.0000.01414.68
5.6.340.0090.00314.42
5.6.330.0030.00614.65
5.6.320.0000.01214.57
5.6.310.0140.00014.42
5.6.300.0090.00314.15
5.6.290.0080.00314.42
5.6.280.0090.00614.70
5.6.270.0000.01414.64
5.6.260.0100.00614.14
5.6.250.0040.00714.42
5.6.240.0070.00314.22
5.6.230.0040.00414.22
5.6.220.0040.00414.22
5.6.210.0070.02317.48
5.6.200.0080.03516.16
5.6.190.0030.03117.54
5.6.180.0140.02517.45
5.6.170.0170.04317.45
5.6.160.0080.03617.50
5.6.150.0070.03916.32
5.6.140.0050.04616.25
5.6.130.0110.02316.22
5.6.120.0120.03217.65
5.6.110.0030.04717.61
5.6.100.0080.04517.57
5.6.90.0030.02517.68
5.6.80.0030.02417.31
5.6.70.0060.00614.21
5.6.60.0070.00714.10
5.6.50.0100.00314.11
5.6.40.0060.00314.46
5.6.30.0030.00914.15
5.6.20.0060.00614.39
5.6.10.0040.00414.15
5.6.00.0090.00614.16
5.5.380.0040.01113.96
5.5.370.0030.01014.30
5.5.360.0070.00414.13
5.5.350.0030.02017.39
5.5.340.0060.05316.10
5.5.330.0100.02017.28
5.5.320.0020.03117.20
5.5.310.0180.02517.29
5.5.300.0060.04116.10
5.5.290.0080.03216.20
5.5.280.0050.03917.39
5.5.270.0020.04717.31
5.5.260.0140.03617.77
5.5.250.0050.04217.55
5.5.240.0030.04717.13
5.5.230.0000.00914.17
5.5.220.0040.00813.98
5.5.210.0070.00714.18
5.5.200.0000.00814.23
5.5.190.0040.01114.02
5.5.180.0000.01314.18
5.5.170.0070.00414.23
5.5.160.0000.00814.38
5.5.150.0130.00314.07
5.5.140.0070.00714.18
5.5.130.0130.00314.25
5.5.120.0070.00414.29
5.5.110.0040.00814.46
5.5.100.0000.00813.95
5.5.90.0030.01014.24
5.5.80.0040.00814.27
5.5.70.0030.00614.37
5.5.60.0060.00614.04
5.5.50.0000.01414.27
5.5.40.0080.00314.17
5.5.30.0060.00614.32
5.5.20.0030.00713.74
5.5.10.0090.00613.88
5.5.00.0130.00314.23
5.4.450.0140.02615.34
5.4.440.0160.02915.45
5.4.430.0100.02515.48
5.4.420.0150.04215.52
5.4.410.0270.03715.50
5.4.400.0180.02915.22
5.4.390.0150.04215.25
5.4.380.0130.04315.37
5.4.370.0220.02515.32
5.4.360.0150.04315.19
5.4.350.0220.04615.32
5.4.340.0100.04315.19
5.4.330.0080.00311.50
5.4.320.0130.02515.32
5.4.310.0170.03615.35
5.4.300.0130.03015.29
5.4.290.0180.02915.32
5.4.280.0150.04015.41
5.4.270.0180.02815.35
5.4.260.0230.03315.37
5.4.250.0160.02015.28
5.4.240.0130.03215.24
5.4.230.0140.02715.29
5.4.220.0240.03215.36
5.4.210.0150.02215.36
5.4.200.0200.03215.22
5.4.190.0200.02715.18
5.4.180.0140.02415.29
5.4.170.0180.03915.31
5.4.160.0130.03015.16
5.4.150.0120.02815.25
5.4.140.0180.04013.94
5.4.130.0240.02413.98
5.4.120.0230.03013.94
5.4.110.0210.03013.95
5.4.100.0220.03513.98
5.4.90.0150.04013.99
5.4.80.0150.02513.95
5.4.70.0190.03413.91
5.4.60.0130.02214.02
5.4.50.0240.02814.03
5.4.40.0220.03314.01
5.4.30.0170.02313.83
5.4.20.0170.03713.91
5.4.10.0140.02614.02
5.4.00.0200.03513.73
5.3.290.0150.02113.08
5.3.280.0220.03313.16
5.3.270.0180.02313.07
5.3.260.0220.02813.02
5.3.250.0260.02613.01
5.3.240.0240.03813.04
5.3.230.0220.02913.14
5.3.220.0190.04013.13
5.3.210.0250.03013.04
5.3.200.0200.03613.00
5.3.190.0210.03313.01
5.3.180.0140.04113.02
5.3.170.0170.03813.15
5.3.160.0220.03513.02
5.3.150.0240.03813.03
5.3.140.0160.04013.07
5.3.130.0200.04213.13
5.3.120.0180.03813.07
5.3.110.0200.03613.04
5.3.100.0200.02713.00
5.3.90.0260.02513.00
5.3.80.0160.02213.00
5.3.70.0220.03513.00
5.3.60.0190.03913.00
5.3.50.0150.02313.00
5.3.40.0230.01813.00
5.3.30.0170.03713.00
5.3.20.0180.03813.00
5.3.10.0210.02213.00
5.3.00.0140.03313.00
5.2.170.0200.04314.51
5.2.160.0300.05014.51
5.2.150.0300.04014.51
5.2.140.0230.03014.51
5.2.130.0270.03314.51
5.2.120.0200.04714.51
5.2.110.0200.03314.51
5.2.100.0330.05014.51
5.2.90.0330.05014.51
5.2.80.0270.05714.51
5.2.70.0330.03314.51
5.2.60.0200.05014.51
5.2.50.0270.02314.51
5.2.40.0130.06014.51
5.2.30.0200.02714.51
5.2.20.0230.02314.51
5.2.10.0300.03714.51
5.2.00.0230.05014.51
5.1.60.0270.03014.51
5.1.50.0230.04014.51
5.1.40.0130.04014.51
5.1.30.0200.04014.51
5.1.20.0200.02314.51
5.1.10.0230.02014.51
5.1.00.0170.02714.51
5.0.50.0130.01714.51
5.0.40.0170.03314.51
5.0.30.0100.03314.51
5.0.20.0100.02314.51
5.0.10.0100.04714.51
5.0.00.0100.05314.51
4.4.90.0070.04014.51
4.4.80.0130.01714.51
4.4.70.0130.01714.51
4.4.60.0100.03714.51
4.4.50.0130.02714.51
4.4.40.0100.05314.51
4.4.30.0100.02014.51
4.4.20.0070.01714.51
4.4.10.0070.01714.51
4.4.00.0070.05714.51
4.3.110.0130.02314.51
4.3.100.0100.01714.51
4.3.90.0100.03314.51
4.3.80.0100.05314.51
4.3.70.0130.02314.51
4.3.60.0100.03714.51
4.3.50.0100.01714.51
4.3.40.0130.03314.51
4.3.30.0070.02314.51
4.3.20.0030.03314.51
4.3.10.0100.03314.51
4.3.00.0030.04014.51

preferences:
38.55 ms | 401 KiB | 5 Q