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 $this; } } // 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.0170.00318.68
8.3.50.0100.00921.14
8.3.40.0100.01018.79
8.3.30.0030.01020.29
8.3.20.0070.00020.29
8.3.10.0000.00722.10
8.3.00.0000.00822.29
8.2.180.0120.00616.75
8.2.170.0150.00622.96
8.2.160.0130.00020.52
8.2.150.0000.00824.18
8.2.140.0110.01124.66
8.2.130.0110.00726.16
8.2.120.0080.00019.54
8.2.110.0060.00322.25
8.2.100.0100.00019.46
8.2.90.0040.00419.07
8.2.80.0040.00419.29
8.2.70.0000.00817.50
8.2.60.0050.00317.80
8.2.50.0090.00018.07
8.2.40.0040.00418.22
8.2.30.0060.00317.95
8.2.20.0080.00017.72
8.2.10.0030.00517.62
8.2.00.0000.00817.71
8.1.280.0140.00725.92
8.1.270.0130.00720.40
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0040.00423.82
8.1.230.0090.00319.21
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0000.00917.38
8.1.190.0050.00317.18
8.1.180.0050.00218.85
8.1.170.0000.00818.49
8.1.160.0040.00422.14
8.1.150.0040.00418.51
8.1.140.0040.00417.50
8.1.130.0030.00317.67
8.1.120.0000.00717.49
8.1.110.0000.00717.34
8.1.100.0000.00817.49
8.1.90.0070.00017.43
8.1.80.0000.00817.52
8.1.70.0000.00717.41
8.1.60.0000.00817.51
8.1.50.0040.00417.50
8.1.40.0040.00417.56
8.1.30.0070.00017.54
8.1.20.0000.00817.66
8.1.10.0030.00517.48
8.1.00.0040.00417.49
8.0.300.0000.00718.77
8.0.290.0040.00417.05
8.0.280.0040.00418.44
8.0.270.0030.00317.17
8.0.260.0000.00716.79
8.0.250.0070.00017.02
8.0.240.0050.00317.05
8.0.230.0000.00716.92
8.0.220.0070.00016.89
8.0.210.0000.00716.95
8.0.200.0060.00016.93
8.0.190.0060.00316.99
8.0.180.0040.00416.96
8.0.170.0000.00816.96
8.0.160.0040.00416.95
8.0.150.0000.00717.00
8.0.140.0000.00816.90
8.0.130.0030.00313.34
8.0.120.0000.00816.85
8.0.110.0080.00016.87
8.0.100.0030.00416.81
8.0.90.0040.00416.91
8.0.80.0070.01016.90
8.0.70.0040.00417.07
8.0.60.0040.00417.02
8.0.50.0000.00716.90
8.0.30.0150.00317.01
8.0.20.0100.01017.40
8.0.10.0000.00816.91
8.0.00.0110.00716.92
7.4.330.0020.00215.00
7.4.320.0000.00716.54
7.4.300.0000.00816.57
7.4.290.0000.00816.47
7.4.280.0040.00416.48
7.4.270.0000.00716.45
7.4.260.0030.00316.51
7.4.250.0030.00316.52
7.4.240.0050.00216.47
7.4.230.0030.00316.42
7.4.220.0090.01316.64
7.4.210.0060.00816.66
7.4.200.0070.00016.32
7.4.190.0030.00316.74
7.4.160.0100.00716.45
7.4.150.0030.01317.40
7.4.140.0100.01317.86
7.4.130.0100.00716.58
7.4.120.0090.00916.52
7.4.110.0150.00616.41
7.4.100.0040.01816.61
7.4.90.0160.00516.52
7.4.80.0060.01219.39
7.4.70.0070.01016.54
7.4.60.0100.00616.60
7.4.50.0050.00316.41
7.4.40.0030.01022.77
7.4.30.0090.01116.58
7.4.10.0130.00615.16
7.4.00.0090.00914.83
7.3.330.0020.00213.22
7.3.320.0050.00013.36
7.3.310.0070.00016.25
7.3.300.0040.00416.29
7.3.290.0030.01016.29
7.3.280.0050.01116.33
7.3.270.0110.00617.40
7.3.260.0130.00316.52
7.3.250.0120.00516.42
7.3.240.0060.01216.42
7.3.230.0030.01416.55
7.3.210.0140.00316.45
7.3.200.0100.00619.39
7.3.190.0080.00916.37
7.3.180.0100.00716.36
7.3.170.0030.01316.38
7.3.160.0110.00616.41
7.3.130.0050.01114.77
7.3.120.0100.00714.79
7.3.110.0080.01214.75
7.3.100.0040.01014.80
7.3.90.0060.00814.74
7.3.80.0030.00914.95
7.3.70.0040.00914.67
7.3.60.0080.00614.73
7.3.50.0030.00814.74
7.3.40.0060.00714.74
7.3.30.0090.00614.81
7.3.20.0060.00616.58
7.3.10.0070.00816.47
7.3.00.0030.00816.66
7.2.330.0040.01216.52
7.2.320.0070.01016.33
7.2.310.0170.00616.39
7.2.300.0110.00616.34
7.2.290.0030.01516.52
7.2.260.0060.01315.18
7.2.250.0050.01114.99
7.2.240.0040.01115.14
7.2.230.0080.00914.88
7.2.220.0070.00515.09
7.2.210.0080.00315.12
7.2.200.0030.00814.90
7.2.190.0020.01215.02
7.2.180.0070.00714.90
7.2.170.0030.01015.05
7.2.160.0070.00415.02
7.2.150.0060.01116.86
7.2.140.0020.01116.99
7.2.130.0040.00816.87
7.2.120.0070.00716.83
7.2.110.0070.00516.84
7.2.100.0060.01116.97
7.2.90.0060.00717.01
7.2.80.0060.00716.93
7.2.70.0090.00416.99
7.2.60.0100.00716.93
7.2.50.0050.00617.06
7.2.40.0080.00817.04
7.2.30.0050.00816.84
7.2.20.0050.00917.02
7.2.10.0060.01016.86
7.2.00.0030.01016.69
7.1.330.0020.01115.81
7.1.320.0070.00715.62
7.1.310.0030.00915.83
7.1.300.0060.00615.88
7.1.290.0020.00815.66
7.1.280.0060.00515.81
7.1.270.0050.00515.76
7.1.260.0020.01015.75
7.1.250.0020.01115.79
7.1.240.0020.00915.72
7.1.230.0050.00815.76
7.1.220.0050.00815.68
7.1.210.0090.00215.57
7.1.200.0070.00415.57
7.1.190.0050.00515.81
7.1.180.0070.00415.49
7.1.170.0050.01015.67
7.1.160.0000.01015.76
7.1.150.0080.00515.73
7.1.140.0100.00515.57
7.1.130.0080.00515.88
7.1.120.0030.01015.77
7.1.110.0060.00815.70
7.1.100.0050.00916.63
7.1.90.0090.00515.77
7.1.80.0030.01315.77
7.1.70.0030.00915.99
7.1.60.0060.00816.81
7.1.50.0080.00716.13
7.1.40.0060.00815.85
7.1.30.0050.00715.65
7.1.20.0030.00815.89
7.1.10.0060.00915.52
7.1.00.0050.01717.99
7.0.330.0020.01115.24
7.0.320.0030.00815.33
7.0.310.0050.01015.39
7.0.300.0040.00915.49
7.0.290.0060.00515.27
7.0.280.0050.00515.42
7.0.270.0090.00315.44
7.0.260.0050.00915.39
7.0.250.0060.00715.45
7.0.240.0060.00615.42
7.0.230.0060.00615.22
7.0.220.0070.00715.36
7.0.210.0090.00315.40
7.0.200.0040.00515.88
7.0.190.0020.00815.40
7.0.180.0040.00815.44
7.0.170.0030.00815.40
7.0.160.0020.00715.44
7.0.150.0060.00615.52
7.0.140.0020.03117.50
7.0.130.0030.00815.54
7.0.120.0080.00515.46
7.0.110.0050.00515.44
7.0.100.0020.02417.01
7.0.90.0060.03416.84
7.0.80.0100.03216.90
7.0.70.0150.02116.77
7.0.60.0100.03016.79
7.0.50.0120.02516.99
7.0.40.0090.03115.72
7.0.30.0050.03415.70
7.0.20.0040.03415.62
7.0.10.0040.03215.71
7.0.00.0070.03415.56
5.6.400.0060.00714.42
5.6.390.0030.00814.12
5.6.380.0080.00714.09
5.6.370.0070.00814.13
5.6.360.0030.00914.35
5.6.350.0030.00914.28
5.6.340.0040.01214.30
5.6.330.0010.00814.58
5.6.320.0090.00814.36
5.6.310.0070.00514.35
5.6.300.0020.00814.45
5.6.290.0040.01014.38
5.6.280.0060.02916.57
5.6.270.0040.01014.23
5.6.260.0060.00414.50
5.6.250.0070.03316.28
5.6.240.0100.03216.32
5.6.230.0060.03616.57
5.6.220.0030.02816.36
5.6.210.0120.02316.56
5.6.200.0030.03516.59
5.6.190.0060.03016.55
5.6.180.0080.02116.48
5.6.170.0060.03216.51
5.6.160.0040.03616.54
5.6.150.0050.02816.41
5.6.140.0050.02816.50
5.6.130.0080.03216.54
5.6.120.0080.02716.60
5.6.110.0110.02816.42
5.6.100.0090.03016.38
5.6.90.0060.03316.62
5.6.80.0050.03216.27
5.6.70.0100.01616.18
5.6.60.0100.01416.19
5.6.50.0030.03516.26
5.6.40.0070.03116.33
5.6.30.0080.02316.30
5.6.20.0030.03416.20
5.6.10.0050.03316.32
5.6.00.0090.01616.19
5.5.380.0050.02916.36
5.5.370.0070.02716.21
5.5.360.0040.03716.50
5.5.350.0070.03416.40
5.5.340.0070.03416.30
5.5.330.0020.02816.50
5.5.320.0070.02316.45
5.5.310.0020.03216.47
5.5.300.0080.03116.60
5.5.290.0050.03316.50
5.5.280.0060.03516.47
5.5.270.0040.03516.51
5.5.260.0080.02916.40
5.5.250.0090.03116.32
5.5.240.0060.03116.11
5.5.230.0070.02916.04
5.5.220.0070.02916.26
5.5.210.0100.01516.16
5.5.200.0030.03416.20
5.5.190.0050.03115.96
5.5.180.0040.02516.13
5.5.170.0050.00914.20
5.5.160.0070.02616.19
5.5.150.0090.02716.03
5.5.140.0080.02416.28
5.5.130.0100.02916.14
5.5.120.0080.02516.19
5.5.110.0080.01816.17
5.5.100.0060.03016.27
5.5.90.0030.03816.11
5.5.80.0080.01716.07
5.5.70.0060.03416.05
5.5.60.0080.01515.98
5.5.50.0060.02816.18
5.5.40.0090.01516.01
5.5.30.0080.02616.19
5.5.20.0090.02616.12
5.5.10.0090.02715.89
5.5.00.0100.02716.10
5.4.450.0090.02414.24
5.4.440.0100.02814.23
5.4.430.0060.03014.19
5.4.420.0070.02714.39
5.4.410.0080.02514.29
5.4.400.0040.03114.17
5.4.390.0060.02814.11
5.4.380.0040.02714.09
5.4.370.0050.02714.15
5.4.360.0080.02914.00
5.4.350.0070.02814.11
5.4.340.0080.02014.15
5.4.330.0040.00511.64
5.4.320.0070.02614.09
5.4.310.0000.02914.24
5.4.300.0070.02614.10
5.4.290.0040.02014.12
5.4.280.0050.02814.11
5.4.270.0060.02014.13
5.4.260.0040.02814.08
5.4.250.0050.01814.20
5.4.240.0050.03114.16
5.4.230.0090.01414.18
5.4.220.0040.03214.09
5.4.210.0090.02514.18
5.4.200.0100.02114.02
5.4.190.0040.01814.11
5.4.180.0050.02814.24
5.4.170.0060.02314.18
5.4.160.0040.02813.99
5.4.150.0030.02414.23
5.4.140.0040.03013.23
5.4.130.0050.02713.32
5.4.120.0060.02013.38
5.4.110.0060.02513.27
5.4.100.0050.02413.29
5.4.90.0020.03113.31
5.4.80.0070.02413.35
5.4.70.0010.02013.26
5.4.60.0060.02713.22
5.4.50.0070.02913.23
5.4.40.0090.02713.31
5.4.30.0060.03213.27
5.4.20.0050.01413.31
5.4.10.0010.02513.24
5.4.00.0070.02413.08
5.3.290.0020.03312.55
5.3.280.0040.03512.42
5.3.270.0040.02712.52
5.3.260.0010.03112.44
5.3.250.0070.02812.50
5.3.240.0050.02612.48
5.3.230.0030.02812.52
5.3.220.0080.02212.47
5.3.210.0060.02012.47
5.3.200.0030.02712.45
5.3.190.0080.01612.47
5.3.180.0040.02112.61
5.3.170.0090.02212.58
5.3.160.0070.02712.50
5.3.150.0070.02912.49
5.3.140.0050.02512.52
5.3.130.0060.03112.50
5.3.120.0080.02312.49
5.3.110.0080.01712.46
5.3.100.0030.02912.36
5.3.90.0060.01612.36
5.3.80.0020.03012.38
5.3.70.0030.02012.35
5.3.60.0030.01612.18
5.3.50.0040.02812.31
5.3.40.0050.03412.25
5.3.30.0050.02412.21
5.3.20.0030.02912.24
5.3.10.0060.01812.14
5.3.00.0040.02812.11
5.2.170.0130.04711.76
5.2.160.0070.03311.76
5.2.150.0100.03011.76
5.2.140.0070.04711.76
5.2.130.0000.05311.76
5.2.120.0100.06011.76
5.2.110.0100.05711.76
5.2.100.0070.06011.76
5.2.90.0070.06011.76
5.2.80.0100.05711.76
5.2.70.0070.06311.76
5.2.60.0030.06311.76
5.2.50.0100.05311.76
5.2.40.0030.06311.76
5.2.30.0070.06011.76
5.2.20.0100.05711.76
5.2.10.0030.06011.76
5.2.00.0030.06311.76
5.1.60.0030.05311.76
5.1.50.0070.04311.76
5.1.40.0000.05311.76
5.1.30.0030.03311.76
5.1.20.0170.02011.76
5.1.10.0000.06311.76
5.1.00.0030.05311.76
5.0.50.0030.04711.76
5.0.40.0100.03311.76
5.0.30.0030.06011.76
5.0.20.0030.02311.76
5.0.10.0000.04311.76
5.0.00.0000.06311.76
4.4.90.0030.02311.76
4.4.80.0000.03711.76
4.4.70.0030.03311.76
4.4.60.0070.03011.76
4.4.50.0070.02311.76
4.4.40.0030.05311.76
4.4.30.0000.03711.76
4.4.20.0000.03711.76
4.4.10.0000.03011.76
4.4.00.0030.03711.76
4.3.110.0030.03311.76
4.3.100.0070.02011.76
4.3.90.0000.02711.76
4.3.80.0000.03011.76
4.3.70.0070.02711.76
4.3.60.0030.03011.76
4.3.50.0030.03311.76
4.3.40.0030.05311.76
4.3.30.0000.02011.76
4.3.20.0030.02711.76
4.3.10.0000.03311.76
4.3.00.0000.03711.76

preferences:
35.81 ms | 400 KiB | 5 Q