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.0180.00018.68
8.3.50.0100.00921.14
8.3.40.0070.00718.71
8.3.30.0060.00820.30
8.3.20.0000.00720.34
8.3.10.0060.00322.13
8.3.00.0050.00322.37
8.2.180.0070.00716.48
8.2.170.0040.01122.96
8.2.160.0030.01020.35
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0100.00326.16
8.2.120.0090.00017.80
8.2.110.0060.00322.12
8.2.100.0110.00019.38
8.2.90.0050.00319.08
8.2.80.0090.00019.19
8.2.70.0000.00817.48
8.2.60.0030.00517.80
8.2.50.0040.00418.07
8.2.40.0030.00618.03
8.2.30.0030.00517.99
8.2.20.0000.00917.79
8.2.10.0040.00417.66
8.2.00.0040.00417.86
8.1.280.0140.00025.92
8.1.270.0070.00024.66
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0090.00023.72
8.1.230.0040.00819.21
8.1.220.0030.00517.74
8.1.210.0000.00918.77
8.1.200.0040.00417.35
8.1.190.0000.00817.54
8.1.180.0000.00819.14
8.1.170.0080.00018.47
8.1.160.0000.00722.02
8.1.150.0040.00418.55
8.1.140.0040.00417.42
8.1.130.0030.00317.70
8.1.120.0040.00417.53
8.1.110.0040.00417.52
8.1.100.0040.00417.45
8.1.90.0030.00317.45
8.1.80.0040.00417.39
8.1.70.0000.00717.41
8.1.60.0000.00817.62
8.1.50.0000.00717.42
8.1.40.0060.00317.40
8.1.30.0030.00617.53
8.1.20.0080.00017.72
8.1.10.0040.00417.48
8.1.00.0000.00717.35
8.0.300.0040.00418.77
8.0.290.0070.00016.93
8.0.280.0000.00718.39
8.0.270.0070.00017.20
8.0.260.0030.00316.77
8.0.250.0000.00716.89
8.0.240.0030.00617.04
8.0.230.0000.00716.90
8.0.220.0080.00016.84
8.0.210.0000.00716.91
8.0.200.0000.00617.03
8.0.190.0040.00417.01
8.0.180.0040.00416.87
8.0.170.0000.00716.99
8.0.160.0080.00017.01
8.0.150.0030.00516.97
8.0.140.0000.00716.80
8.0.130.0050.00013.34
8.0.120.0050.00316.89
8.0.110.0040.00416.96
8.0.100.0050.00317.02
8.0.90.0040.00416.79
8.0.80.0070.01316.90
8.0.70.0050.00216.96
8.0.60.0040.00417.02
8.0.50.0050.00216.91
8.0.30.0090.01117.06
8.0.20.0030.01617.40
8.0.10.0040.00417.04
8.0.00.0090.00916.77
7.4.330.0000.00615.00
7.4.320.0000.00616.59
7.4.300.0030.00316.43
7.4.290.0040.00416.60
7.4.280.0040.00416.46
7.4.270.0030.00316.65
7.4.260.0000.00716.52
7.4.250.0040.00416.46
7.4.240.0020.00516.55
7.4.230.0030.00316.62
7.4.220.0210.00016.38
7.4.210.0070.01116.51
7.4.200.0000.00716.70
7.4.190.0030.00316.56
7.4.160.0090.00616.29
7.4.150.0180.00017.40
7.4.140.0090.01117.86
7.4.130.0080.01316.75
7.4.120.0090.01116.49
7.4.110.0090.00916.45
7.4.100.0080.01116.38
7.4.90.0110.00716.38
7.4.80.0060.01219.39
7.4.70.0100.00616.48
7.4.60.0100.00916.39
7.4.50.0000.00416.54
7.4.40.0030.01222.77
7.4.30.0100.00716.46
7.4.00.0090.00615.06
7.3.330.0050.00013.36
7.3.320.0000.00613.15
7.3.310.0000.00716.39
7.3.300.0070.00016.36
7.3.290.0080.00516.36
7.3.280.0080.00916.31
7.3.270.0130.00717.40
7.3.260.0070.01016.48
7.3.250.0100.00916.50
7.3.240.0100.00716.40
7.3.230.0110.01216.39
7.3.210.0110.01016.52
7.3.200.0080.00919.39
7.3.190.0100.01316.32
7.3.180.0120.00916.33
7.3.170.0030.01216.48
7.3.160.0060.00916.31
7.3.120.0030.01014.86
7.2.330.0060.01216.61
7.2.320.0090.01416.57
7.2.310.0030.01616.34
7.2.300.0080.00816.77
7.2.290.0120.00916.41
7.2.110.0110.00516.52
7.2.100.0080.00816.40
7.2.90.0110.00416.36
7.2.80.0100.00316.42
7.2.70.0090.00617.05
7.2.60.0120.01016.93
7.2.50.0110.00616.86
7.2.40.0260.00017.07
7.2.30.0090.01516.94
7.2.20.0110.00716.80
7.2.10.0120.00616.90
7.2.00.0070.00718.15
7.1.230.0080.00815.80
7.1.220.0100.01315.77
7.1.210.0120.00615.81
7.1.200.0080.00615.77
7.1.190.0100.00415.55
7.1.180.0210.00815.70
7.1.170.0080.00815.72
7.1.160.0190.00015.75
7.1.150.0100.00515.66
7.1.140.0160.00415.83
7.1.130.0110.00715.57
7.1.120.0230.00015.49
7.1.110.0160.00315.73
7.1.100.0130.00316.91
7.1.90.0240.00815.60
7.1.80.0160.00315.88
7.1.70.0100.00916.26
7.1.60.0130.01117.68
7.1.50.0190.00316.44
7.1.40.0110.01115.89
7.1.30.0130.00715.85
7.1.20.0160.00615.76
7.1.10.0180.00015.81
7.1.00.0100.01519.19
7.0.310.0070.00715.19
7.0.300.0200.00315.28
7.0.290.0140.00615.19
7.0.280.0110.00915.56
7.0.270.0110.00415.36
7.0.260.0250.00315.13
7.0.250.0120.00315.39
7.0.240.0100.00515.39
7.0.230.0110.00415.54
7.0.220.0150.00415.46
7.0.210.0250.00415.46
7.0.200.0080.00315.95
7.0.190.0100.00715.48
7.0.180.0080.00815.20
7.0.170.0070.00715.16
7.0.160.0120.00315.52
7.0.150.0090.00515.43
7.0.140.0080.04118.64
7.0.130.0040.00815.45
7.0.120.0150.00315.51
7.0.110.0050.00915.31
7.0.100.0180.00415.55
7.0.90.0100.00715.36
7.0.80.0110.00415.09
7.0.70.0080.00815.57
7.0.60.0070.04517.66
7.0.50.0230.02516.68
7.0.40.0090.04616.82
7.0.30.0180.04716.90
7.0.20.0160.02516.84
7.0.10.0100.04616.86
7.0.00.0100.02316.82
5.6.380.0120.00914.24
5.6.370.0160.00014.14
5.6.360.0070.01014.01
5.6.350.0120.00514.47
5.6.340.0190.00014.09
5.6.330.0110.00714.10
5.6.320.0140.00314.45
5.6.310.0160.00014.37
5.6.300.0060.00914.45
5.6.290.0090.00914.29
5.6.280.0030.04317.75
5.6.270.0120.00614.11
5.6.260.0050.01014.16
5.6.250.0090.00914.21
5.6.240.0150.00014.41
5.6.230.0110.00614.46
5.6.220.0150.00014.12
5.6.210.0040.04917.36
5.6.200.0050.03916.29
5.6.190.0110.03717.37
5.6.180.0220.03517.43
5.6.170.0210.03817.24
5.6.160.0080.04617.37
5.6.150.0070.02416.25
5.6.140.0130.03016.12
5.6.130.0060.04016.24
5.6.120.0100.04717.71
5.6.110.0080.02717.85
5.6.100.0080.04717.71
5.6.90.0100.04517.77
5.6.80.0130.02117.30
5.6.70.0110.00714.09
5.6.60.0100.00514.10
5.6.50.0070.00714.16
5.6.40.0100.01014.22
5.6.30.0150.00114.14
5.6.20.0100.00514.43
5.6.10.0120.00614.07
5.6.00.0110.00614.21
5.5.380.0030.00912.79
5.5.370.0110.00312.79
5.5.360.0080.00412.79
5.5.350.0030.02116.66
5.5.340.0060.03115.38
5.5.330.0050.02716.56
5.5.320.0090.02516.57
5.5.310.0230.03816.54
5.5.300.0100.03515.43
5.5.290.0110.03315.36
5.5.280.0060.02416.84
5.5.270.0100.04216.78
5.5.260.0080.03116.83
5.5.250.0090.03016.76
5.5.240.0200.03216.48
5.5.230.0030.00612.79
5.5.220.0060.00312.79
5.5.210.0090.00012.79
5.5.200.0090.00612.79
5.5.190.0030.00612.79
5.5.180.0090.00212.79
5.5.170.0100.00314.22
5.5.160.0100.00012.79
5.5.150.0090.00612.79
5.5.140.0120.00012.79
5.5.130.0080.00412.79
5.5.120.0150.00412.79
5.5.110.0050.00912.79
5.5.100.0150.00012.79
5.5.90.0060.00612.79
5.5.80.0050.00512.79
5.5.70.0070.00212.79
5.5.60.0140.00012.79
5.5.50.0120.00012.79
5.5.40.0090.00312.79
5.5.30.0130.00012.79
5.5.20.0060.00912.79
5.5.10.0050.00512.79
5.5.00.0040.00712.79
5.4.450.0180.03016.13
5.4.440.0500.03016.24
5.4.430.0400.03316.18
5.4.420.0430.03816.20
5.4.410.0440.03416.12
5.4.400.0520.02915.90
5.4.390.0360.03516.03
5.4.380.0240.03215.76
5.4.370.0120.02815.71
5.4.360.0160.02115.69
5.4.350.0110.01912.41
5.4.340.0090.02012.41
5.4.330.0090.00412.79
5.4.320.0100.02012.65
5.4.310.0060.02412.65
5.4.300.0070.02112.65
5.4.290.0060.02112.65
5.4.280.0080.02212.60
5.4.270.0060.02412.60
5.4.260.0060.02412.59
5.4.250.0090.03115.88
5.4.240.0130.02215.90
5.4.230.0090.02615.87
5.4.220.0050.03215.78
5.4.210.0070.02915.71
5.4.200.0060.03115.94
5.4.190.0090.02715.79
5.4.180.0100.02915.86
5.4.170.0170.02315.84
5.4.160.0050.03315.87
5.4.150.0090.02615.90
5.4.140.0090.02714.62
5.4.130.0130.03114.70
5.4.120.0060.02814.63
5.4.110.0050.03014.68
5.4.100.0100.02514.67
5.4.90.0120.02214.63
5.4.80.0110.03114.69
5.4.70.0090.02314.62
5.4.60.0100.02414.63
5.4.50.0070.02814.72
5.4.40.0130.02714.62
5.4.30.0110.03014.67
5.4.20.0070.02814.69
5.4.10.0100.02614.64
5.4.00.0090.03014.39
5.3.290.0050.02512.79
5.3.280.0020.03413.70
5.3.270.0070.04113.69
5.3.260.0100.02813.79
5.3.250.0070.02713.71
5.3.240.0080.02713.62
5.3.230.0100.02513.78
5.3.220.0050.02813.69
5.3.210.0110.02313.77
5.3.200.0040.03213.72
5.3.190.0050.02813.79
5.3.180.0110.02313.76
5.3.170.0100.02313.69
5.3.160.0090.02613.77
5.3.150.0100.02513.67
5.3.140.0090.02313.68
5.3.130.0120.02313.68
5.3.120.0070.02813.63
5.3.110.0090.02813.76
5.3.100.0080.02513.46
5.3.90.0090.02313.49
5.3.80.0050.02713.36
5.3.70.0040.02813.44
5.3.60.0070.02713.43
5.3.50.0070.02813.40
5.3.40.0070.02813.41
5.3.30.0080.02313.30
5.3.20.0080.02713.16
5.3.10.0160.02513.26
5.3.00.0130.02313.13
5.2.170.0040.02411.95
5.2.160.0040.02412.01
5.2.150.0040.02711.96
5.2.140.0060.02312.01
5.2.130.0050.02211.98
5.2.120.0050.02312.03
5.2.110.0040.02511.94
5.2.100.0070.02212.04
5.2.90.0130.02311.99
5.2.80.0030.02611.90
5.2.70.0030.02611.98
5.2.60.0090.02011.97
5.2.50.0100.01711.90
5.2.40.0060.01811.94
5.2.30.0030.02311.88
5.2.20.0060.02111.92
5.2.10.0100.01811.94
5.2.00.0020.02511.75
5.1.60.0030.02111.44
5.1.50.0030.02011.43
5.1.40.0040.02111.48
5.1.30.0050.02011.56
5.1.20.0020.02211.55
5.1.10.0080.01711.35
5.1.00.0040.01911.42
5.0.50.0060.01510.72
5.0.40.0050.01610.58
5.0.30.0020.02310.51
5.0.20.0090.01010.52
5.0.10.0080.01210.52
5.0.00.0020.02510.47
4.4.90.0020.01310.08
4.4.80.0020.01310.08
4.4.70.0060.00910.08
4.4.60.0040.01210.08
4.4.50.0020.01410.08
4.4.40.0040.01710.08
4.4.30.0000.01510.08
4.4.20.0080.00810.08
4.4.10.0060.01010.08
4.4.00.0030.01810.08
4.3.110.0020.01410.08
4.3.100.0030.01210.08
4.3.90.0040.01010.08
4.3.80.0000.01910.08
4.3.70.0000.01410.08
4.3.60.0060.00810.08
4.3.50.0040.01210.08
4.3.40.0000.02010.08
4.3.30.0020.01210.08
4.3.20.0060.00810.08
4.3.10.0020.01410.08
4.3.00.0030.01210.45

preferences:
34.6 ms | 401 KiB | 5 Q