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) { var_dump('yo'); 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.0140.00718.43
8.3.50.0160.00522.04
8.3.40.0170.00318.88
8.3.30.0120.00619.04
8.3.20.0040.00420.26
8.3.10.0080.00022.08
8.3.00.0090.00022.34
8.2.180.0080.00816.75
8.2.170.0040.01122.96
8.2.160.0120.00620.93
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0030.00626.16
8.2.120.0040.00417.75
8.2.110.0030.00622.20
8.2.100.0080.00417.78
8.2.90.0080.00019.07
8.2.80.0050.00317.97
8.2.70.0030.00617.75
8.2.60.0030.00517.93
8.2.50.0000.00818.07
8.2.40.0060.00318.22
8.2.30.0040.00418.13
8.2.20.0000.00717.71
8.2.10.0040.00417.68
8.2.00.0040.00417.66
8.1.280.0130.00725.92
8.1.270.0060.00321.93
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0040.00423.79
8.1.230.0110.00018.96
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0030.00617.48
8.1.190.0050.00317.41
8.1.180.0030.00618.10
8.1.170.0000.00818.64
8.1.160.0000.00722.03
8.1.150.0030.00618.68
8.1.140.0040.00417.45
8.1.130.0040.00417.76
8.1.120.0040.00417.54
8.1.110.0000.00817.53
8.1.100.0040.00417.46
8.1.90.0030.00517.45
8.1.80.0040.00417.46
8.1.70.0040.00417.43
8.1.60.0030.00917.47
8.1.50.0040.00417.43
8.1.40.0000.00717.41
8.1.30.0000.00717.64
8.1.20.0040.00417.51
8.1.10.0050.00317.58
8.1.00.0060.00317.38
8.0.300.0040.00418.77
8.0.290.0000.00717.16
8.0.280.0000.00718.46
8.0.270.0030.00317.23
8.0.260.0030.00316.89
8.0.250.0030.00317.00
8.0.240.0050.00316.89
8.0.230.0000.00817.05
8.0.220.0000.00716.86
8.0.210.0000.00716.85
8.0.200.0030.00317.08
8.0.190.0060.00316.97
8.0.180.0000.01017.05
8.0.170.0000.00717.03
8.0.160.0040.00416.94
8.0.150.0000.00716.82
8.0.140.0000.00716.90
8.0.130.0030.00313.36
8.0.120.0000.00816.95
8.0.110.0040.00416.94
8.0.100.0040.00417.00
8.0.90.0000.00716.82
8.0.80.0070.00717.01
8.0.70.0040.00416.96
8.0.60.0000.00716.87
8.0.50.0000.00717.00
8.0.30.0150.00516.97
8.0.20.0110.00717.43
8.0.10.0040.00417.16
8.0.00.0060.01516.87
7.4.330.0000.00515.10
7.4.320.0040.00416.53
7.4.300.0000.00616.60
7.4.290.0040.00416.52
7.4.280.0030.00516.44
7.4.270.0070.00016.63
7.4.260.0080.00316.61
7.4.250.0000.00816.40
7.4.240.0040.00316.55
7.4.230.0000.00716.64
7.4.220.0060.01316.48
7.4.210.0070.01016.54
7.4.200.0060.00316.32
7.4.190.0040.00416.61
7.4.160.0120.00416.53
7.4.150.0070.01017.40
7.4.140.0140.00517.86
7.4.130.0180.00616.67
7.4.120.0110.00916.54
7.4.110.0120.00616.66
7.4.100.0070.01016.62
7.4.90.0090.00916.31
7.4.80.0080.01619.39
7.4.70.0130.00416.43
7.4.60.0110.00616.56
7.4.50.0030.00616.43
7.4.40.0070.00822.77
7.4.30.0030.01416.73
7.4.00.0030.01514.98
7.3.330.0070.00013.34
7.3.320.0030.00313.44
7.3.310.0040.00416.29
7.3.300.0040.00416.22
7.3.290.0130.00616.38
7.3.280.0070.01116.36
7.3.270.0110.00617.40
7.3.260.0000.01816.36
7.3.250.0120.00516.36
7.3.240.0090.01416.41
7.3.230.0100.00716.50
7.3.210.0120.00616.39
7.3.200.0140.01019.39
7.3.190.0110.01116.45
7.3.180.0090.00616.41
7.3.170.0120.01216.38
7.3.160.0100.00716.36
7.3.120.0060.00614.96
7.2.330.0160.00916.48
7.2.320.0030.01416.52
7.2.310.0090.00916.70
7.2.300.0060.01116.45
7.2.290.0100.01016.48
7.2.60.0000.01416.94
7.2.00.0190.01119.29
7.1.200.0130.00015.72
7.1.100.0000.01018.01
7.1.70.0000.01017.10
7.1.60.0130.00319.82
7.1.50.0100.01317.04
7.1.00.0000.08022.41
7.0.200.0030.00616.79
7.0.140.0030.07721.96
7.0.60.0130.08019.93
7.0.50.0070.08317.81
7.0.40.0030.09020.27
7.0.30.0570.06720.13
7.0.20.0230.07720.16
7.0.10.0070.06320.12
7.0.00.0100.05020.14
5.6.280.0000.07721.14
5.6.210.0170.07020.75
5.6.200.0030.04018.29
5.6.190.0100.08720.48
5.6.180.0300.06720.57
5.6.170.0130.05020.58
5.6.160.0100.07720.55
5.6.150.0100.07718.27
5.6.140.0030.04018.16
5.6.130.0030.07018.27
5.6.120.0130.07320.93
5.6.110.0070.03721.15
5.6.100.0030.08720.98
5.6.90.0070.06720.96
5.6.80.0100.07320.39
5.5.350.0130.04020.43
5.5.340.0030.03718.00
5.5.330.0030.09020.21
5.5.320.0470.06720.27
5.5.310.0270.07720.27
5.5.300.0100.04717.93
5.5.290.0030.05018.06
5.5.280.0130.05720.79
5.5.270.0170.07320.79
5.5.260.0070.08020.87
5.5.250.0070.04020.62
5.5.240.4270.03720.03
5.4.450.0100.04319.50
5.4.440.0370.04719.48
5.4.430.0470.05719.69
5.4.420.0500.05019.16
5.4.410.0170.07719.45
5.4.400.0130.04718.74
5.4.390.0100.05318.57
5.4.380.0230.05718.71
5.4.370.0130.05718.64
5.4.360.0230.05018.53
5.4.350.0130.06018.44
5.4.340.0170.05718.65
5.4.320.0050.03712.51
5.4.310.0050.04412.51
5.4.300.0060.04312.51
5.4.290.0090.04112.51
5.4.280.0030.03912.40
5.4.270.0070.07718.86
5.4.260.0070.06319.14
5.4.250.0170.06719.05
5.4.240.0030.06019.02
5.4.230.0170.06319.14
5.4.220.0100.05318.98
5.4.210.0130.05019.01
5.4.200.0130.04719.02
5.4.190.0170.05019.13
5.4.180.0070.07718.99
5.4.170.0130.07318.94
5.4.160.0130.05718.99
5.4.150.0170.07318.97
5.4.140.0130.04716.56
5.4.130.0070.05316.68
5.4.120.0070.05316.71
5.4.110.0100.05716.69
5.4.100.0170.04716.75
5.4.90.0170.05716.63
5.4.80.0130.05316.47
5.4.70.0100.05716.72
5.4.60.0130.06316.40
5.4.50.0100.05316.60
5.4.40.0170.06716.44
5.4.30.0030.05316.66
5.4.20.0100.05316.39
5.4.10.0200.05316.50
5.4.00.0130.05015.84
5.3.290.0080.04112.80
5.3.280.0100.05314.63
5.3.270.0170.05314.89
5.3.260.0200.06714.92
5.3.250.0100.05314.67
5.3.240.0070.06314.90
5.3.230.0000.07014.66
5.3.220.0100.05014.57
5.3.210.0130.07014.86
5.3.200.0100.06014.63
5.3.190.0100.05314.66
5.3.180.0170.04314.84
5.3.170.0170.04314.87
5.3.160.0070.05714.45
5.3.150.0100.06714.77
5.3.140.0130.05314.63
5.3.130.0230.05714.79
5.3.120.0100.05714.86
5.3.110.0130.06714.61
5.3.100.0130.04314.31
5.3.90.0000.05714.20
5.3.80.0130.05313.91
5.3.70.0070.06014.14
5.3.60.0070.05014.22
5.3.50.0170.04314.25
5.3.40.0100.05014.01
5.3.30.0100.04713.98
5.3.20.0130.04713.92
5.3.10.0100.05313.94
5.3.00.0230.04013.93
5.2.170.0000.04711.03
5.2.160.0130.04711.35
5.2.150.0070.04711.43
5.2.140.0100.05011.43
5.2.130.0030.04311.32
5.2.120.0130.03711.39
5.2.110.0030.04711.40
5.2.100.0030.05011.38
5.2.90.0100.03711.37
5.2.80.0130.03711.15
5.2.70.0100.06011.29
5.2.60.0100.05011.36
5.2.50.0070.04711.29
5.2.40.0100.04011.29
5.2.30.0070.04010.86
5.2.20.0070.04311.16
5.2.10.0130.03311.14
5.2.00.0030.05010.73
5.1.60.0030.03710.00
5.1.50.0100.04310.11
5.1.40.0130.04310.29
5.1.30.0030.05310.56
5.1.20.0130.03310.41
5.1.10.0030.03710.29
5.1.00.0130.0279.96
5.0.50.0000.0338.82
5.0.40.0070.0278.59
5.0.30.0030.0478.12
5.0.20.0100.0238.52
5.0.10.0030.0278.38
5.0.00.0170.0408.38
4.4.90.0030.0277.45
4.4.80.0130.0137.45
4.4.70.0030.0307.45
4.4.60.0070.0207.45
4.4.50.0030.0277.45
4.4.40.0100.0277.45
4.4.30.0100.0237.45
4.4.20.0030.0237.45
4.4.10.0000.0237.45
4.4.00.0030.0337.45
4.3.110.0070.0207.45
4.3.100.0100.0177.45
4.3.90.0030.0237.45
4.3.80.0070.0337.45
4.3.70.0030.0237.45
4.3.60.0030.0277.45
4.3.50.0000.0237.45
4.3.40.0030.0437.45
4.3.30.0030.0237.45
4.3.20.0000.0277.45
4.3.10.0030.0277.45
4.3.00.0000.0206.43

preferences:
42.26 ms | 401 KiB | 5 Q