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(){ new the(); } function the(){ return 4; } 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.01418.30
8.3.50.0100.00921.09
8.3.40.0140.00318.84
8.3.30.0150.00020.33
8.3.20.0040.00420.29
8.3.10.0040.00422.14
8.3.00.0000.00822.58
8.2.180.0040.01216.63
8.2.170.0070.00722.96
8.2.160.0100.00320.53
8.2.150.0080.00024.18
8.2.140.0030.00524.66
8.2.130.0040.01426.16
8.2.120.0060.00617.63
8.2.110.0090.00020.38
8.2.100.0060.00617.91
8.2.90.0080.00019.11
8.2.80.0060.00319.21
8.2.70.0090.00017.46
8.2.60.0040.00417.80
8.2.50.0080.00018.10
8.2.40.0040.00420.55
8.2.30.0040.00419.36
8.2.20.0000.00817.72
8.2.10.0040.00417.81
8.2.00.0050.00317.75
8.1.280.0120.00925.92
8.1.270.0040.00424.66
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0180.00323.84
8.1.230.0080.00420.02
8.1.220.0060.00317.74
8.1.210.0040.00418.77
8.1.200.0000.00917.35
8.1.190.0080.00017.22
8.1.180.0050.00318.10
8.1.170.0040.00418.54
8.1.160.0080.00018.99
8.1.150.0050.00320.09
8.1.140.0040.00417.50
8.1.130.0000.00717.74
8.1.120.0000.00717.49
8.1.110.0040.00417.43
8.1.100.0040.00417.39
8.1.90.0030.00317.37
8.1.80.0040.00417.37
8.1.70.0000.00717.39
8.1.60.0040.00417.59
8.1.50.0050.00317.54
8.1.40.0000.00817.50
8.1.30.0060.00317.66
8.1.20.0040.00417.69
8.1.10.0000.00817.48
8.1.00.0000.00817.49
8.0.300.0000.00718.77
8.0.290.0070.00016.75
8.0.280.0030.00518.36
8.0.270.0030.00317.27
8.0.260.0000.00616.85
8.0.250.0030.00317.01
8.0.240.0040.00416.91
8.0.230.0000.00716.95
8.0.220.0040.00416.89
8.0.210.0000.00716.84
8.0.200.0040.00417.07
8.0.190.0080.00317.09
8.0.180.0000.00716.89
8.0.170.0000.00716.93
8.0.160.0000.00716.95
8.0.150.0040.00416.92
8.0.140.0050.00316.93
8.0.130.0050.00013.39
8.0.120.0000.00816.92
8.0.110.0000.00716.91
8.0.100.0000.00716.78
8.0.90.0040.00416.74
8.0.80.0030.01317.06
8.0.70.0070.00016.83
8.0.60.0040.00417.00
8.0.50.0000.00817.01
8.0.30.0100.00816.89
8.0.20.0080.01017.40
8.0.10.0040.00416.95
8.0.00.0120.00616.99
7.4.330.0000.00515.00
7.4.320.0060.00016.56
7.4.300.0070.00016.47
7.4.290.0040.00716.60
7.4.280.0030.00316.42
7.4.270.0040.00416.59
7.4.260.0070.00016.63
7.4.250.0000.00716.47
7.4.240.0060.00216.60
7.4.230.0080.00016.63
7.4.220.0100.00716.55
7.4.210.0050.01016.57
7.4.200.0000.00716.54
7.4.190.0040.00416.50
7.4.160.0120.00316.55
7.4.150.0110.00717.40
7.4.140.0130.00717.86
7.4.130.0090.00716.56
7.4.120.0120.00716.60
7.4.110.0110.00616.55
7.4.100.0070.01016.74
7.4.90.0110.00616.55
7.4.80.0090.01519.39
7.4.70.0080.00916.60
7.4.60.0040.01416.55
7.4.50.0000.00416.41
7.4.40.0090.00622.77
7.4.30.0080.00816.36
7.4.00.0090.01014.97
7.3.330.0050.00013.32
7.3.320.0030.00313.35
7.3.310.0070.00016.17
7.3.300.0030.00316.27
7.3.290.0040.01116.45
7.3.280.0060.00816.38
7.3.270.0100.00717.40
7.3.260.0120.00816.57
7.3.250.0120.00516.51
7.3.240.0150.00316.42
7.3.230.0030.01316.50
7.3.210.0090.00916.30
7.3.200.0130.00319.39
7.3.190.0160.00716.54
7.3.180.0100.00616.45
7.3.170.0080.00816.44
7.3.160.0100.00616.35
7.3.120.0060.01114.90
7.3.110.0070.00914.72
7.3.100.0070.01014.80
7.3.90.0060.00814.88
7.3.80.0040.01014.75
7.3.70.0020.01114.79
7.3.60.0030.01014.80
7.3.50.0070.00614.92
7.3.40.0050.00714.68
7.3.30.0040.00514.55
7.3.20.0070.00716.58
7.3.10.0080.00716.50
7.3.00.0060.00916.43
7.2.330.0120.01216.75
7.2.320.0160.00716.37
7.2.310.0070.01016.79
7.2.300.0080.00816.80
7.2.290.0090.01216.57
7.2.250.0060.01315.06
7.2.240.0050.01215.05
7.2.230.0030.01014.70
7.2.220.0080.00815.14
7.2.210.0100.00615.14
7.2.200.0080.00815.06
7.2.190.0080.01014.99
7.2.180.0050.01314.90
7.2.170.0080.00514.78
7.2.160.0000.01714.90
7.2.150.0000.01516.85
7.2.140.0060.00316.82
7.2.130.0070.00416.85
7.2.120.0030.00716.80
7.2.110.0040.00416.64
7.2.100.0000.01016.58
7.2.90.0040.01516.85
7.2.80.0030.01316.92
7.2.70.0100.01016.54
7.2.60.0040.00716.75
7.2.50.0030.01416.84
7.2.40.0110.00416.78
7.2.30.0030.01216.88
7.2.20.0030.01016.82
7.2.10.0070.00716.67
7.2.00.0040.00918.16
7.1.330.0080.00715.60
7.1.320.0030.01215.65
7.1.310.0050.00615.94
7.1.300.0050.01015.66
7.1.290.0120.00215.65
7.1.280.0010.01215.63
7.1.270.0100.00115.53
7.1.260.0050.00915.50
7.1.250.0060.00315.73
7.1.240.0070.00715.86
7.1.230.0060.00615.83
7.1.220.0050.00315.45
7.1.210.0090.00615.66
7.1.200.0060.00915.71
7.1.190.0110.00715.57
7.1.180.0050.00315.81
7.1.170.0000.01115.72
7.1.160.0080.00415.55
7.1.150.0070.00715.77
7.1.140.0070.00715.79
7.1.130.0000.00815.63
7.1.120.0070.00715.70
7.1.110.0060.00615.66
7.1.100.0060.00915.52
7.1.90.0050.00515.81
7.1.80.0060.00615.73
7.1.70.0040.00716.23
7.1.60.0050.01516.34
7.1.50.0060.01316.38
7.1.40.0070.01115.79
7.1.30.0060.01015.76
7.1.20.0100.00315.73
7.1.10.0070.00815.71
7.1.00.0080.03519.06
7.0.330.0040.00815.49
7.0.320.0000.00815.38
7.0.310.0070.00715.32
7.0.300.0060.00615.45
7.0.290.0070.00715.28
7.0.280.0000.01115.32
7.0.270.0060.00315.30
7.0.260.0040.00715.34
7.0.250.0040.00815.34
7.0.240.0000.01315.51
7.0.230.0040.00715.08
7.0.220.0080.00415.45
7.0.210.0060.00315.25
7.0.200.0060.00915.90
7.0.190.0090.00915.33
7.0.180.0000.01515.46
7.0.170.0070.01015.43
7.0.160.0100.00315.37
7.0.150.0000.01415.32
7.0.140.0100.03818.63
7.0.130.0130.00315.48
7.0.120.0060.00615.35
7.0.110.0120.00415.20
7.0.100.0000.00915.41
7.0.90.0060.01215.41
7.0.80.0000.01315.36
7.0.70.0110.00015.35
7.0.60.0080.04617.51
7.0.50.0050.02916.49
7.0.40.0110.04516.75
7.0.30.0130.02216.74
7.0.20.0100.02616.81
7.0.10.0130.02816.92
7.0.00.0050.02516.76
5.6.400.0040.00814.61
5.6.390.0070.01114.44
5.6.380.0110.00414.05
5.6.370.0110.00413.99
5.6.360.0080.00814.42
5.6.350.0060.00614.08
5.6.340.0030.00914.06
5.6.330.0000.01314.63
5.6.320.0000.01414.16
5.6.310.0090.00614.34
5.6.300.0080.00413.97
5.6.290.0070.00714.28
5.6.280.0040.04017.58
5.6.270.0060.00614.11
5.6.260.0030.01414.38
5.6.250.0040.00813.97
5.6.240.0110.00414.22
5.6.230.0000.01414.19
5.6.220.0060.00914.16
5.6.210.0080.03417.46
5.6.200.0090.04016.28
5.6.190.0070.04917.36
5.6.180.0120.02517.50
5.6.170.0210.03017.40
5.6.160.0090.04217.35
5.6.150.0050.03916.18
5.6.140.0070.03316.46
5.6.130.0050.04916.20
5.6.120.0080.04017.64
5.6.110.0130.04217.49
5.6.100.0090.02217.62
5.6.90.0030.05017.60
5.6.80.0080.03517.38
5.6.70.2110.02217.30
5.6.60.0040.00414.21
5.6.50.0040.00814.13
5.6.40.0040.01114.16
5.6.30.0090.00314.38
5.6.20.0150.00014.15
5.6.10.0000.01514.04
5.6.00.0100.00314.18
5.5.380.0070.00714.55
5.5.370.0040.00914.18
5.5.360.0090.00613.95
5.5.350.0060.03817.39
5.5.340.0040.02116.27
5.5.330.0050.02817.13
5.5.320.0150.02817.17
5.5.310.0200.03617.41
5.5.300.0050.03716.25
5.5.290.0050.04516.17
5.5.280.0070.04217.45
5.5.270.0040.04717.53
5.5.260.0170.01817.44
5.5.250.0070.04217.55
5.5.240.0170.03717.21
5.5.230.0070.01014.03
5.5.220.0030.00714.31
5.5.210.0000.01314.23
5.5.200.0030.01214.25
5.5.190.0000.01114.23
5.5.180.0070.00714.14
5.5.170.0000.01714.04
5.5.160.0060.00314.23
5.5.150.0060.00913.90
5.5.140.0100.00314.10
5.5.130.0000.01114.07
5.5.120.0070.01014.16
5.5.110.0030.01014.34
5.5.100.0100.00313.93
5.5.90.0040.01113.96
5.5.80.0000.01014.14
5.5.70.0060.00314.02
5.5.60.0000.01514.29
5.5.50.0060.00614.06
5.5.40.0070.00313.96
5.5.30.0130.00314.13
5.5.20.0070.00714.29
5.5.10.0090.00613.95
5.5.00.0150.00013.87
5.4.450.0330.03215.35
5.4.440.0180.03115.12
5.4.430.0270.03715.22
5.4.420.0380.03615.33
5.4.410.0490.03315.15
5.4.400.0380.02915.04
5.4.390.0420.03215.06
5.4.380.0160.02614.87
5.4.370.0100.02714.92
5.4.360.0140.02314.95
5.4.350.0040.02211.60
5.4.340.0090.02011.59
5.4.330.0030.00511.04
5.4.320.0050.02211.76
5.4.310.0050.02211.72
5.4.300.0080.01811.62
5.4.290.0060.02211.75
5.4.280.0050.02011.79
5.4.270.0040.02511.68
5.4.260.0060.02511.61
5.4.250.0080.02714.94
5.4.240.0150.02815.10
5.4.230.0030.03214.86
5.4.220.0100.02514.93
5.4.210.0070.02514.82
5.4.200.0110.02514.95
5.4.190.0030.03214.86
5.4.180.0050.03214.88
5.4.170.0110.02514.86
5.4.160.0060.03015.07
5.4.150.0030.03514.84
5.4.140.0050.03913.59
5.4.130.0140.02813.77
5.4.120.0030.03213.72
5.4.110.0050.03813.66
5.4.100.0100.02613.70
5.4.90.0030.03913.64
5.4.80.0120.02813.74
5.4.70.0090.03413.70
5.4.60.0050.02813.64
5.4.50.0030.02713.56
5.4.40.0050.02813.58
5.4.30.0070.03113.71
5.4.20.0080.03213.69
5.4.10.0070.02813.80
5.4.00.0080.03313.42
5.3.290.0070.02011.63
5.3.280.0110.02312.48
5.3.270.0050.03612.69
5.3.260.0100.02412.61
5.3.250.0030.03212.62
5.3.240.0070.03812.54
5.3.230.0080.03012.54
5.3.220.0050.02812.48
5.3.210.0100.02612.42
5.3.200.0070.03612.47
5.3.190.0070.02912.53
5.3.180.0030.03012.55
5.3.170.0050.02812.62
5.3.160.0050.03312.47
5.3.150.0030.03412.55
5.3.140.0050.02812.70
5.3.130.0100.02712.56
5.3.120.0070.03212.51
5.3.110.0070.03112.59
5.3.100.0100.03212.25
5.3.90.0080.03112.30
5.3.80.0020.03212.32
5.3.70.0050.02712.27
5.3.60.0060.02812.33
5.3.50.0030.03812.28
5.3.40.0070.03612.30
5.3.30.0020.03312.15
5.3.20.0070.02812.13
5.3.10.0080.02311.83
5.3.00.0070.02511.96
5.2.170.0030.04311.31
5.2.160.0000.04710.99
5.2.150.0070.04011.15
5.2.140.0030.04711.32
5.2.130.0070.04011.20
5.2.120.0030.04011.09
5.2.110.0100.03711.09
5.2.100.0030.05711.20
5.2.90.0030.04011.09
5.2.80.0030.05311.00
5.2.70.0000.04711.28
5.2.60.0030.04310.96
5.2.50.0100.03711.01
5.2.40.0070.04310.98
5.2.30.0070.04310.95
5.2.20.0070.04010.94
5.2.10.0030.05710.86
5.2.00.0000.04310.72
5.1.60.0070.03310.25
5.1.50.0070.03010.07
5.1.40.0100.04010.23
5.1.30.0030.04710.43
5.1.20.0070.03710.45
5.1.10.0030.03710.11
5.1.00.0030.0379.91
5.0.50.0000.0338.40
5.0.40.0130.0238.52
5.0.30.0030.0538.23
5.0.20.0000.0308.16
5.0.10.0070.0278.34
5.0.00.0000.0478.14
4.4.90.0030.0206.57
4.4.80.0030.0276.49
4.4.70.0030.0206.48
4.4.60.0030.0206.48
4.4.50.0030.0206.48
4.4.40.0030.0436.48
4.4.30.0030.0306.48
4.4.20.0030.0276.48
4.4.10.0100.0136.48
4.4.00.0030.0376.48
4.3.110.0000.0236.48
4.3.100.0100.0206.48
4.3.90.0030.0206.48
4.3.80.0000.0337.34
4.3.70.0070.0177.34
4.3.60.0000.0237.34
4.3.50.0030.0207.34
4.3.40.0070.0277.34
4.3.30.0030.0207.34
4.3.20.0000.0237.34
4.3.10.0030.0207.34
4.3.00.0000.0238.10

preferences:
54 ms | 401 KiB | 5 Q