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(){ } public function the(){ } 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.0090.00616.50
8.3.50.0120.00717.45
8.3.40.0120.00318.84
8.3.30.0150.00018.85
8.3.20.0060.00318.86
8.3.10.0000.00820.53
8.3.00.0060.00319.26
8.2.180.0100.01016.75
8.2.170.0140.00022.96
8.2.160.0100.00321.19
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0040.00419.48
8.2.110.0070.00420.35
8.2.100.0090.00318.03
8.2.90.0030.00519.21
8.2.80.0080.00017.97
8.2.70.0040.00417.63
8.2.60.0090.00018.16
8.2.50.0060.00318.10
8.2.40.0000.00718.34
8.2.30.0000.00718.05
8.2.20.0000.00919.54
8.2.10.0040.00417.62
8.2.00.0000.00917.62
8.1.280.0080.01125.92
8.1.270.0040.00424.66
8.1.260.0050.00326.35
8.1.250.0050.00328.09
8.1.240.0060.00322.27
8.1.230.0090.00317.71
8.1.220.0060.00317.74
8.1.210.0040.00418.77
8.1.200.0060.00317.34
8.1.190.0060.00317.24
8.1.180.0030.00518.10
8.1.170.0000.00818.89
8.1.160.0050.00218.77
8.1.150.0000.00718.64
8.1.140.0000.00817.41
8.1.130.0000.00717.81
8.1.120.0040.00417.37
8.1.110.0040.00417.38
8.1.100.0040.00317.36
8.1.90.0000.00917.45
8.1.80.0040.00417.53
8.1.70.0000.00717.44
8.1.60.0040.00417.64
8.1.50.0040.00417.45
8.1.40.0080.00017.52
8.1.30.0030.00517.66
8.1.20.0000.00717.63
8.1.10.0000.00717.54
8.1.00.0080.00017.36
8.0.300.0070.00418.77
8.0.290.0060.00316.75
8.0.280.0000.00718.52
8.0.270.0040.00417.25
8.0.260.0000.00716.95
8.0.250.0000.00716.93
8.0.240.0000.00716.93
8.0.230.0070.00016.89
8.0.220.0050.00216.96
8.0.210.0000.00716.97
8.0.200.0000.00616.91
8.0.190.0000.00717.06
8.0.180.0050.00316.96
8.0.170.0000.00816.95
8.0.160.0040.00416.95
8.0.150.0050.00516.94
8.0.140.0030.00616.90
8.0.130.0000.00613.39
8.0.120.0000.00816.81
8.0.110.0040.00416.98
8.0.100.0060.00316.86
8.0.90.0040.00416.92
8.0.80.0060.01017.01
8.0.70.0000.00716.91
8.0.60.0000.00716.77
8.0.50.0050.00216.90
8.0.30.0090.01117.03
8.0.20.0050.01417.08
8.0.10.0040.00416.87
8.0.00.0070.01316.75
7.4.330.0030.00313.07
7.4.320.0040.00416.49
7.4.300.0030.00316.61
7.4.290.0040.00416.41
7.4.280.0030.00516.43
7.4.270.0030.00316.62
7.4.260.0050.00013.40
7.4.250.0070.00316.57
7.4.240.0040.00416.53
7.4.230.0030.00316.61
7.4.220.0070.01016.46
7.4.210.0080.00616.62
7.4.200.0030.00316.63
7.4.190.0030.00316.57
7.4.160.0110.00716.40
7.4.150.0130.01316.50
7.4.140.0100.01216.61
7.4.130.0090.00916.49
7.4.120.0120.00816.46
7.4.110.0080.00816.62
7.4.100.0150.00316.34
7.4.90.0060.01216.55
7.4.80.0110.01119.39
7.4.70.0110.00716.43
7.4.60.0030.01416.66
7.4.50.0060.00316.57
7.4.40.0030.01216.62
7.4.30.0080.00816.46
7.4.00.0070.00714.79
7.3.330.0030.00313.30
7.3.320.0050.00013.22
7.3.310.0030.00316.39
7.3.300.0000.00716.40
7.3.290.0100.00716.46
7.3.280.0080.01116.34
7.3.270.0120.00616.26
7.3.260.0100.00716.39
7.3.250.0160.00616.37
7.3.240.0070.01116.35
7.3.230.0120.00616.51
7.3.210.0060.01516.39
7.3.200.0120.00916.48
7.3.190.0120.00916.55
7.3.180.0060.00916.29
7.3.170.0110.00616.36
7.3.160.0060.01316.38
7.3.120.0120.00314.97
7.3.00.0100.00316.50
7.2.330.0090.00916.74
7.2.320.0070.01016.68
7.2.310.0060.02116.75
7.2.300.0090.00916.30
7.2.290.0100.00716.76
7.2.130.0040.01116.79
7.2.120.0090.00616.55
7.2.110.0090.00616.79
7.2.100.0040.00816.77
7.2.90.0110.00716.51
7.2.80.0060.01016.75
7.2.70.0070.00716.61
7.2.60.0140.00016.55
7.2.50.0080.00916.71
7.2.40.0030.01016.95
7.2.30.0140.00316.80
7.2.20.0080.00416.63
7.2.10.0060.00616.87
7.2.00.0060.01118.08
7.1.250.0100.00615.71
7.1.240.0110.00315.59
7.1.230.0090.00615.80
7.1.220.0160.00015.77
7.1.210.0120.00615.44
7.1.200.0050.00815.60
7.1.190.0120.00415.64
7.1.180.0030.01315.65
7.1.170.0040.00715.39
7.1.160.0070.00415.53
7.1.150.0090.00315.64
7.1.140.0090.00315.70
7.1.130.0090.00615.59
7.1.120.0150.00315.64
7.1.110.0070.01115.55
7.1.100.0080.00816.91
7.1.90.0070.01015.82
7.1.80.0110.00415.54
7.1.70.0030.00716.18
7.1.60.0070.01217.49
7.1.50.0060.01016.33
7.1.40.0030.00915.68
7.1.30.0070.00715.48
7.1.20.0070.00715.80
7.1.10.0090.00315.82
7.1.00.0080.03719.06
7.0.330.0040.01115.39
7.0.320.0130.00315.28
7.0.310.0070.01015.34
7.0.300.0070.00715.38
7.0.290.0100.00314.98
7.0.280.0040.00815.13
7.0.270.0100.00315.30
7.0.260.0100.00315.36
7.0.250.0130.00315.29
7.0.240.0130.00315.13
7.0.230.0090.00615.27
7.0.220.0110.00415.35
7.0.210.0100.00315.40
7.0.200.0140.00515.14
7.0.190.0110.00015.33
7.0.180.0060.00915.22
7.0.170.0070.00715.37
7.0.160.0070.00715.46
7.0.150.0080.00615.21
7.0.140.0090.03418.73
7.0.130.0100.00315.36
7.0.120.0050.04018.69
7.0.110.0110.00015.42
7.0.100.0030.01015.41
7.0.90.0100.00015.32
7.0.80.0030.00915.28
7.0.70.0160.00015.28
7.0.60.0050.04617.43
7.0.50.0090.03816.65
7.0.40.0230.03816.52
7.0.30.0200.04116.77
7.0.20.0180.02616.67
7.0.10.0150.03216.67
7.0.00.0120.02816.70
5.6.380.0110.00014.41
5.6.370.0120.00013.91
5.6.360.0000.01114.01
5.6.350.0030.00614.37
5.6.340.0040.00414.34
5.6.330.0040.00414.36
5.6.320.0100.00313.98
5.6.310.0060.00614.46
5.6.300.0070.00314.59
5.6.290.0050.00513.92
5.6.280.0050.03717.66
5.6.270.0000.01114.41
5.6.260.0030.01014.25
5.6.250.0060.00614.20
5.6.240.0070.00314.30
5.6.230.0030.01314.20
5.6.220.0070.00714.53
5.6.210.0050.02217.42
5.6.200.0070.02716.31
5.6.190.0190.02717.20
5.6.180.0180.02617.35
5.6.170.0160.03117.34
5.6.160.0200.03317.51
5.6.150.0250.03117.25
5.6.140.0210.02517.41
5.6.130.0200.02217.33
5.6.120.0200.04117.15
5.6.110.0120.03017.30
5.6.100.0150.03217.22
5.6.90.0180.03717.10
5.6.80.0190.04016.92
5.6.70.0210.04116.81
5.6.60.0180.04016.84
5.6.50.0170.03216.85
5.6.40.0170.03816.84
5.6.30.0220.03816.91
5.6.20.0250.03016.81
5.6.10.0160.04216.95
5.6.00.0180.04317.02
5.5.380.0000.01111.29
5.5.370.0030.00711.36
5.5.360.0070.00311.36
5.5.350.0050.03815.73
5.5.340.0040.03014.61
5.5.330.0180.03815.76
5.5.320.0200.03815.75
5.5.310.0180.02315.76
5.5.300.0190.03315.46
5.5.290.0190.04215.60
5.5.280.0180.03815.50
5.5.270.0130.02915.32
5.5.260.0170.02715.59
5.5.250.0240.03415.57
5.5.240.0200.03315.15
5.5.230.0150.03315.27
5.5.220.0150.04015.24
5.5.210.0180.03715.36
5.5.200.0170.04015.26
5.5.190.0170.03815.09
5.5.180.0160.04315.31
5.5.170.0030.01011.12
5.5.160.0160.03515.17
5.5.150.0170.03915.23
5.5.140.0200.03015.12
5.5.130.0210.03315.21
5.5.120.0170.03015.25
5.5.110.0170.02215.28
5.5.100.0130.02515.11
5.5.90.0180.02515.28
5.5.80.0130.02715.12
5.5.70.0170.04015.06
5.5.60.0170.02214.98
5.5.50.0180.03615.23
5.5.40.0200.04015.21
5.5.30.0150.03415.12
5.5.20.0180.02315.13
5.5.10.0170.03514.98
5.5.00.0180.03015.18
5.4.450.0140.02715.10
5.4.440.0170.02715.12
5.4.430.0180.02815.16
5.4.420.0130.04415.15
5.4.410.0150.02715.24
5.4.400.0180.02814.78
5.4.390.0220.03715.03
5.4.380.0170.03714.97
5.4.370.0210.03415.07
5.4.360.0160.04114.99
5.4.350.0170.02115.10
5.4.340.0150.03214.75
5.4.330.0070.00310.96
5.4.320.0200.03515.11
5.4.310.0170.03215.04
5.4.300.0160.02515.15
5.4.290.0220.03115.00
5.4.280.0170.02514.99
5.4.270.0170.03014.90
5.4.260.0260.03115.04
5.4.250.0150.02514.97
5.4.240.0190.01914.83
5.4.230.0120.02614.88
5.4.220.0180.03714.92
5.4.210.0170.03014.86
5.4.200.0220.01815.12
5.4.190.0180.02714.92
5.4.180.0150.03914.76
5.4.170.0170.03415.08
5.4.160.0150.02614.91
5.4.150.0200.03715.01
5.4.140.0180.03613.74
5.4.130.0170.03413.63
5.4.120.0130.03013.82
5.4.110.0200.03213.73
5.4.100.0120.02513.80
5.4.90.0200.02813.67
5.4.80.0130.02913.63
5.4.70.0200.03013.55
5.4.60.0170.03313.49
5.4.50.0170.02013.54
5.4.40.0220.03013.69
5.4.30.0180.02213.59
5.4.20.0180.03713.39
5.4.10.0220.02313.63
5.4.00.0190.02213.35
5.3.290.0170.02912.68
5.3.280.0130.02812.55
5.3.270.0150.04212.60
5.3.260.0150.02712.64
5.3.250.0170.03212.56
5.3.240.0150.03112.58
5.3.230.0170.01812.57
5.3.220.0160.02312.57
5.3.210.0220.02312.56
5.3.200.0170.02712.63
5.3.190.0160.03812.59
5.3.180.0220.03712.66
5.3.170.0260.02812.65
5.3.160.0130.03412.65
5.3.150.0150.02312.71
5.3.140.0230.01812.61
5.3.130.0200.02812.60
5.3.120.0150.03112.58
5.3.110.0220.02512.60
5.3.100.0200.02212.23
5.3.90.0150.02412.40
5.3.80.0170.03212.35
5.3.70.0160.02612.29
5.3.60.0160.02112.26
5.3.50.0270.02812.32
5.3.40.0170.03612.24
5.3.30.0150.03912.19
5.3.20.0190.03312.11
5.3.10.0240.03912.10
5.3.00.0220.02912.05
5.2.170.0140.02011.97
5.2.160.0150.02911.97
5.2.150.0160.01811.97
5.2.140.0140.03011.97
5.2.130.0190.02911.97
5.2.120.0130.02811.97
5.2.110.0110.03311.97
5.2.100.0170.03011.97
5.2.90.0140.02711.97
5.2.80.0130.02911.97
5.2.70.0190.02111.97
5.2.60.0160.02811.97
5.2.50.0140.02111.97
5.2.40.0150.02111.97
5.2.30.0160.02811.97
5.2.20.0160.02811.97
5.2.10.0120.02311.97
5.2.00.0150.03011.97
5.1.60.0150.02911.97
5.1.50.0140.02711.97
5.1.40.0160.02511.97
5.1.30.0160.02011.97
5.1.20.0100.01911.97
5.1.10.0120.03211.97
5.1.00.0100.03011.97
5.0.50.0090.02511.97
5.0.40.0050.02211.97
5.0.30.0050.03511.97
5.0.20.0070.01811.97
5.0.10.0080.02311.97
5.0.00.0070.03511.97
4.4.90.0050.01211.97
4.4.80.0080.01011.97
4.4.70.0100.01311.97
4.4.60.0060.01611.97
4.4.50.0110.01811.97
4.4.40.0030.02311.97
4.4.30.0060.01011.97
4.4.20.0070.01811.97
4.4.10.0080.01311.97
4.4.00.0080.02811.97
4.3.110.0070.01711.97
4.3.100.0080.01611.97
4.3.90.0030.01811.97
4.3.80.0030.02211.97
4.3.70.0080.01311.97
4.3.60.0040.01011.97
4.3.50.0050.01311.97
4.3.40.0090.02611.97
4.3.30.0030.01211.97
4.3.20.0070.01711.97
4.3.10.0050.02111.97
4.3.00.0040.01611.97

preferences:
75.01 ms | 401 KiB | 5 Q