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 $this; } public function the() { return $this; } 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.0140.00718.18
8.3.50.0120.00622.04
8.3.40.0150.00418.85
8.3.30.0090.00619.21
8.3.20.0040.00420.05
8.3.10.0030.00521.91
8.3.00.0050.00222.40
8.2.180.0060.01216.50
8.2.170.0040.01122.96
8.2.160.0070.00720.89
8.2.150.0050.00224.18
8.2.140.0000.00824.66
8.2.130.0070.00026.16
8.2.120.0030.00619.36
8.2.110.0100.00722.16
8.2.100.0080.00417.72
8.2.90.0080.00018.98
8.2.80.0080.00018.03
8.2.70.0060.00317.50
8.2.60.0030.00717.93
8.2.50.0000.00818.07
8.2.40.0050.00518.22
8.2.30.0000.00717.99
8.2.20.0060.00317.53
8.2.10.0000.00717.59
8.2.00.0000.00717.63
8.1.280.0090.00625.92
8.1.270.0060.00321.95
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0100.00623.79
8.1.230.0080.00321.00
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0080.00317.23
8.1.190.0070.00017.53
8.1.180.0000.00818.10
8.1.170.0030.00518.43
8.1.160.0040.00421.89
8.1.150.0040.00418.64
8.1.140.0000.00717.43
8.1.130.0000.00817.73
8.1.120.0000.00717.43
8.1.110.0080.00017.46
8.1.100.0040.00417.43
8.1.90.0000.00717.31
8.1.80.0070.00017.37
8.1.70.0030.00317.42
8.1.60.0080.00017.62
8.1.50.0050.00217.54
8.1.40.0000.00717.50
8.1.30.0070.00017.58
8.1.20.0000.00817.69
8.1.10.0080.00017.62
8.1.00.0040.00417.50
8.0.300.0040.00418.77
8.0.290.0040.00417.05
8.0.280.0070.00018.40
8.0.270.0000.00717.25
8.0.260.0060.00016.79
8.0.250.0000.00716.90
8.0.240.0000.00717.03
8.0.230.0000.00716.91
8.0.220.0070.00016.95
8.0.210.0000.00716.83
8.0.200.0000.00716.88
8.0.190.0030.00516.85
8.0.180.0040.00416.89
8.0.170.0040.00416.97
8.0.160.0030.00616.93
8.0.150.0070.00016.75
8.0.140.0000.00716.95
8.0.130.0030.00313.36
8.0.120.0040.00416.94
8.0.110.0060.00316.78
8.0.100.0040.00416.90
8.0.90.0000.00716.96
8.0.80.0200.00316.87
8.0.70.0080.00016.90
8.0.60.0050.00316.94
8.0.50.0070.00016.96
8.0.30.0110.00817.09
8.0.20.0120.00617.40
8.0.10.0000.00816.90
8.0.00.0120.00516.83
7.4.330.0000.00515.03
7.4.320.0060.00316.66
7.4.300.0040.00416.53
7.4.290.0030.00316.48
7.4.280.0030.00316.41
7.4.270.0030.00316.48
7.4.260.0040.00716.43
7.4.250.0030.00516.48
7.4.240.0050.00216.63
7.4.230.0030.00316.58
7.4.220.0110.01116.46
7.4.210.0050.01116.55
7.4.200.0030.00316.36
7.4.190.0070.00016.46
7.4.160.0110.00416.62
7.4.150.0070.01017.40
7.4.140.0080.01017.86
7.4.130.0120.00716.46
7.4.120.0110.00916.58
7.4.110.0100.00716.61
7.4.100.0070.01016.40
7.4.90.0120.00616.50
7.4.80.0120.01119.39
7.4.70.0100.01016.58
7.4.60.0030.01316.68
7.4.50.0030.00616.53
7.4.40.0040.01122.77
7.4.30.0140.00316.64
7.4.10.0070.01115.08
7.4.00.0070.01014.91
7.3.330.0070.00013.18
7.3.320.0000.00513.18
7.3.310.0040.00416.25
7.3.300.0060.00016.17
7.3.290.0030.01016.35
7.3.280.0060.01216.35
7.3.270.0170.00017.40
7.3.260.0110.00716.63
7.3.250.0070.00916.51
7.3.240.0060.01216.41
7.3.230.0070.01016.48
7.3.210.0110.00716.48
7.3.200.0080.01119.39
7.3.190.0120.00916.34
7.3.180.0070.01016.60
7.3.170.0100.01316.28
7.3.160.0100.00716.43
7.3.130.0040.00914.81
7.3.120.0090.00914.78
7.3.110.0080.00814.73
7.3.100.0050.00914.86
7.3.90.0080.00914.84
7.3.80.0100.00514.85
7.3.70.0060.00614.69
7.3.60.0060.00914.54
7.3.50.0060.00614.64
7.3.40.0070.00714.80
7.3.30.0060.00814.77
7.3.20.0080.00616.74
7.3.10.0070.00716.65
7.3.00.0060.00616.51
7.2.330.0060.01216.75
7.2.320.0060.01816.67
7.2.310.0100.01016.64
7.2.300.0050.01116.74
7.2.290.0080.00816.77
7.2.260.0090.00615.00
7.2.250.0030.01315.04
7.2.240.0040.00914.83
7.2.230.0030.00915.04
7.2.220.0080.00614.96
7.2.210.0040.01014.95
7.2.200.0040.00715.02
7.2.190.0050.01215.01
7.2.180.0080.00714.86
7.2.170.0050.01014.93
7.2.160.0080.00814.93
7.2.150.0060.00916.98
7.2.140.0050.01116.86
7.2.130.0060.00816.89
7.2.120.0070.00516.95
7.2.110.0050.00816.83
7.2.100.0090.00516.78
7.2.90.0030.01016.93
7.2.80.0070.00916.68
7.2.70.0050.00916.84
7.2.60.0040.00816.84
7.2.50.0060.00516.95
7.2.40.0060.00716.88
7.2.30.0030.01016.75
7.2.20.0060.00716.87
7.2.10.0060.00816.81
7.2.00.0060.00717.30
7.1.330.0070.00715.81
7.1.320.0030.01315.68
7.1.310.0030.01015.70
7.1.300.0090.00615.60
7.1.290.0110.00515.85
7.1.280.0080.00715.68
7.1.270.0090.00615.63
7.1.260.0070.00515.70
7.1.250.0060.00615.69
7.1.240.0070.00315.40
7.1.230.0090.00315.79
7.1.220.0060.00815.60
7.1.210.0060.00815.58
7.1.200.0040.00515.56
7.1.190.0100.00315.78
7.1.180.0060.00615.74
7.1.170.0040.00815.63
7.1.160.0070.00615.72
7.1.150.0030.01015.61
7.1.140.0070.00615.85
7.1.130.0020.01315.70
7.1.120.0080.00815.72
7.1.110.0040.01015.67
7.1.100.0100.00316.40
7.1.90.0050.00815.69
7.1.80.0040.01115.65
7.1.70.0050.00916.20
7.1.60.0040.01217.15
7.1.50.0110.00416.13
7.1.40.0060.00515.69
7.1.30.0070.00615.60
7.1.20.0060.00415.74
7.1.10.0080.00815.77
7.1.00.0040.03017.92
7.0.330.0060.00515.39
7.0.320.0030.00915.35
7.0.310.0030.00815.21
7.0.300.0020.00915.43
7.0.290.0050.01015.37
7.0.280.0040.00915.34
7.0.270.0070.00515.36
7.0.260.0040.01115.22
7.0.250.0020.00715.25
7.0.240.0060.00815.45
7.0.230.0050.00915.26
7.0.220.0060.00615.34
7.0.210.0060.00515.33
7.0.200.0070.00615.92
7.0.190.0070.00715.23
7.0.180.0040.00715.40
7.0.170.0020.01315.36
7.0.160.0090.00315.37
7.0.150.0040.01015.45
7.0.140.0060.02717.71
7.0.130.0070.00815.38
7.0.120.0060.00515.36
7.0.110.0050.00715.41
7.0.100.0030.02516.91
7.0.90.0070.02816.90
7.0.80.0110.02416.90
7.0.70.0020.03516.87
7.0.60.0060.03216.90
7.0.50.0070.03617.07
7.0.40.0020.02815.72
7.0.30.0050.03415.59
7.0.20.0050.02515.67
7.0.10.0020.02415.67
7.0.00.0030.02715.63
5.6.400.0060.00613.87
5.6.390.0000.01414.37
5.6.380.0050.01214.27
5.6.370.0030.00814.02
5.6.360.0080.00414.28
5.6.350.0030.01014.28
5.6.340.0030.01014.45
5.6.330.0080.00314.50
5.6.320.0050.00514.27
5.6.310.0090.00914.53
5.6.300.0050.00614.50
5.6.290.0040.01014.34
5.6.280.0080.02516.50
5.6.270.0040.01214.49
5.6.260.0090.00514.05
5.6.250.0090.02816.48
5.6.240.0090.02716.42
5.6.230.0030.03616.53
5.6.220.0090.02016.27
5.6.210.0110.02916.41
5.6.200.0110.02816.61
5.6.190.0100.02616.58
5.6.180.0120.02516.45
5.6.170.0070.03116.47
5.6.160.0050.03216.40
5.6.150.0010.03616.48
5.6.140.0040.03416.59
5.6.130.0060.02716.53
5.6.120.0070.03016.46
5.6.110.0050.03116.43
5.6.100.0010.02516.46
5.6.90.0060.02916.50
5.6.80.0090.02716.28
5.6.70.0080.03116.27
5.6.60.0040.03316.08
5.6.50.0060.03216.30
5.6.40.0060.03116.12
5.6.30.0010.03716.35
5.6.20.0090.03016.26
5.6.10.0060.03116.31
5.6.00.0090.01816.21
5.5.380.0060.02915.07
5.5.370.0060.02815.26
5.5.360.0060.03015.18
5.5.350.0050.02915.23
5.5.340.0060.02015.52
5.5.330.0030.03215.35
5.5.320.0060.03415.43
5.5.310.0070.02415.43
5.5.300.0060.03115.31
5.5.290.0080.03015.39
5.5.280.0080.03215.34
5.5.270.0040.02815.16
5.5.260.0070.02715.37
5.5.250.0060.03015.30
5.5.240.0030.02915.11
5.5.230.0060.02915.14
5.5.220.0070.02615.16
5.5.210.0020.03415.10
5.5.200.0070.02815.14
5.5.190.0060.03015.07
5.5.180.0070.03215.04
5.5.170.0060.00412.59
5.5.160.0090.02915.06
5.5.150.0090.02614.93
5.5.140.0060.02915.15
5.5.130.0060.03215.03
5.5.120.0030.03114.99
5.5.110.0070.02815.12
5.5.100.0090.02615.20
5.5.90.0020.03214.99
5.5.80.0050.03214.96
5.5.70.0050.03014.98
5.5.60.0100.02515.14
5.5.50.0120.02415.13
5.5.40.0090.02515.04
5.5.30.0030.03015.16
5.5.20.0070.02915.00
5.5.10.0060.03115.07
5.5.00.0020.03414.86
5.4.450.0090.02713.69
5.4.440.0090.01613.82
5.4.430.0040.01913.88
5.4.420.0030.03213.88
5.4.410.0030.02813.75
5.4.400.0020.02813.80
5.4.390.0040.03013.68
5.4.380.0080.02513.59
5.4.370.0080.02413.63
5.4.360.0070.02513.76
5.4.350.0070.01713.85
5.4.340.0020.03213.55
5.4.330.0030.00511.06
5.4.320.0020.03213.64
5.4.310.0030.02913.81
5.4.300.0040.01813.79
5.4.290.0060.02713.75
5.4.280.0080.02613.72
5.4.270.0050.02913.63
5.4.260.0070.02613.60
5.4.250.0030.01813.74
5.4.240.0050.02913.59
5.4.230.0070.03013.75
5.4.220.0060.03213.54
5.4.210.0050.02813.77
5.4.200.0040.03113.70
5.4.190.0040.03113.68
5.4.180.0060.02613.68
5.4.170.0050.02513.57
5.4.160.0020.02113.61
5.4.150.0100.02213.66
5.4.140.0040.02812.74
5.4.130.0070.02112.93
5.4.120.0050.02612.82
5.4.110.0060.02712.78
5.4.100.0050.02512.82
5.4.90.0030.03012.92
5.4.80.0060.02712.83
5.4.70.0050.02612.83
5.4.60.0040.02512.72
5.4.50.0060.02312.81
5.4.40.0050.02612.82
5.4.30.0090.02712.81
5.4.20.0040.03012.82
5.4.10.0040.02812.71
5.4.00.0050.02812.59
5.3.290.0080.02712.18
5.3.280.0060.02812.05
5.3.270.0090.02412.15
5.3.260.0110.02412.10
5.3.250.0060.01912.08
5.3.240.0050.02912.01
5.3.230.0060.03012.04
5.3.220.0080.02611.99
5.3.210.0050.03211.96
5.3.200.0100.02812.05
5.3.190.0100.02612.04
5.3.180.0030.03412.02
5.3.170.0070.02112.08
5.3.160.0030.02812.09
5.3.150.0010.03212.11
5.3.140.0040.02912.08
5.3.130.0050.02811.97
5.3.120.0060.02211.97
5.3.110.0040.03012.01
5.3.100.0080.02511.91
5.3.90.0010.03411.97
5.3.80.0050.02811.80
5.3.70.0070.02711.95
5.3.60.0030.03011.87
5.3.50.0060.02411.87
5.3.40.0020.02511.81
5.3.30.0040.02911.89
5.3.20.0010.03211.70
5.3.10.0060.01911.71
5.3.00.0060.02811.73
5.2.170.0030.03510.71
5.2.160.0050.02910.73
5.2.150.0050.02310.76
5.2.140.0030.03310.71
5.2.130.0030.03610.71
5.2.120.0080.03010.74
5.2.110.0000.03310.71
5.2.100.0050.03110.71
5.2.90.0000.03710.73
5.2.80.0030.01910.71
5.2.70.0060.02810.71
5.2.60.0020.03010.71
5.2.50.0030.03510.71
5.2.40.0030.03010.71
5.2.30.0100.01510.71
5.2.20.0060.02510.71
5.2.10.0030.02710.71
5.2.00.0020.03610.71
5.1.60.0050.02010.71
5.1.50.0020.03110.71
5.1.40.0040.02510.71
5.1.30.0020.02210.71
5.1.20.0040.03010.71
5.1.10.0070.02510.71
5.1.00.0030.02910.71
5.0.50.0050.02010.71
5.0.40.0020.02410.71
5.0.30.0030.02210.71
5.0.20.0020.02510.71
5.0.10.0050.02010.71
5.0.00.0020.03410.71
4.4.90.0030.01710.71
4.4.80.0020.01810.71
4.4.70.0020.01810.71
4.4.60.0060.01010.71
4.4.50.0000.02310.71
4.4.40.0000.02810.71
4.4.30.0020.02110.71
4.4.20.0030.01610.71
4.4.10.0040.00810.71
4.4.00.0010.01610.71
4.3.110.0070.01710.71
4.3.100.0020.01910.71
4.3.90.0000.02110.71
4.3.80.0000.01910.71
4.3.70.0030.01510.71
4.3.60.0000.02110.71
4.3.50.0040.01710.71
4.3.40.0030.02610.71
4.3.30.0010.01810.71
4.3.20.0010.02010.71
4.3.10.0000.01710.71
4.3.00.0030.01710.71

preferences:
31.5 ms | 401 KiB | 5 Q