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 echo $this->Question->answer; // 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.0120.00918.68
8.3.50.0020.01422.05
8.3.40.0100.01018.79
8.3.30.0100.00320.07
8.3.20.0040.00420.34
8.3.10.0000.00922.09
8.3.00.0000.00822.45
8.2.180.0130.01016.63
8.2.170.0140.00022.96
8.2.160.0090.00420.35
8.2.150.0040.00424.18
8.2.140.0070.01124.66
8.2.130.0140.00426.16
8.2.120.0080.00019.54
8.2.110.0000.00922.02
8.2.100.0090.00319.34
8.2.90.0090.00019.23
8.2.80.0050.00219.25
8.2.70.0030.00517.63
8.2.60.0040.00418.04
8.2.50.0050.00318.07
8.2.40.0040.00419.66
8.2.30.0030.00517.87
8.2.20.0040.00417.71
8.2.10.0040.00417.59
8.2.00.0110.00017.72
8.1.280.0030.01725.92
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00323.82
8.1.230.0080.00318.90
8.1.220.0070.00017.74
8.1.210.0000.00818.77
8.1.200.0080.00017.11
8.1.190.0000.00817.55
8.1.180.0040.00420.25
8.1.170.0000.00818.46
8.1.160.0000.00722.01
8.1.150.0040.00418.47
8.1.140.0040.00417.32
8.1.130.0030.00317.80
8.1.120.0030.00317.23
8.1.110.0020.00517.37
8.1.100.0000.00717.31
8.1.90.0040.00417.28
8.1.80.0040.00417.38
8.1.70.0030.00317.31
8.1.60.0030.00617.44
8.1.50.0060.00317.38
8.1.40.0040.00417.34
8.1.30.0060.00317.45
8.1.20.0060.00317.48
8.1.10.0070.00017.50
8.1.00.0040.00417.41
8.0.300.0000.00718.77
8.0.290.0030.00317.17
8.0.280.0000.00718.31
8.0.270.0000.00717.18
8.0.260.0000.00716.77
8.0.250.0070.00016.82
8.0.240.0040.00416.84
8.0.230.0050.00216.92
8.0.220.0030.00316.78
8.0.210.0000.00716.77
8.0.200.0000.00616.94
8.0.190.0060.00316.85
8.0.180.0040.00416.80
8.0.170.0040.00416.94
8.0.160.0070.00016.90
8.0.150.0030.00516.72
8.0.140.0040.00416.83
8.0.130.0050.00013.32
8.0.120.0030.00616.86
8.0.110.0000.00716.77
8.0.100.0000.00816.90
8.0.90.0000.00716.93
8.0.80.0060.00916.93
8.0.70.0000.00716.68
8.0.60.0000.00716.89
8.0.50.0040.00417.00
8.0.30.0080.01017.02
8.0.20.0110.00817.40
8.0.10.0080.00016.90
8.0.00.0080.00816.60
7.4.330.0000.00515.00
7.4.320.0000.00716.35
7.4.300.0040.00416.50
7.4.290.0080.00016.54
7.4.280.0040.00416.52
7.4.270.0000.00716.45
7.4.260.0000.00716.29
7.4.250.0040.00416.49
7.4.240.0030.00316.31
7.4.230.0000.00616.64
7.4.220.0150.00316.48
7.4.210.0080.00716.57
7.4.200.0030.00316.27
7.4.190.0030.00316.39
7.4.160.0090.01316.46
7.4.150.0140.00417.40
7.4.140.0140.00517.86
7.4.130.0090.00916.32
7.4.120.0070.01016.39
7.4.110.0080.01216.64
7.4.100.0040.01416.42
7.4.90.0130.00316.73
7.4.80.0030.01619.39
7.4.70.0060.01216.36
7.4.60.0100.00716.43
7.4.50.0000.00516.23
7.4.40.0090.00922.77
7.4.30.0000.01916.36
7.4.00.0030.01014.81
7.3.330.0000.00613.32
7.3.320.0050.00013.24
7.3.310.0080.00016.19
7.3.300.0030.00316.21
7.3.290.0140.00616.31
7.3.280.0060.00916.25
7.3.270.0120.00817.40
7.3.260.0210.00416.44
7.3.250.0080.00816.44
7.3.240.0030.01416.16
7.3.230.0070.01416.39
7.3.210.0090.00616.33
7.3.200.0080.00819.39
7.3.190.0160.00616.32
7.3.180.0060.01016.25
7.3.170.0120.00316.32
7.3.160.0030.01216.64
7.3.120.0000.01614.97
7.2.330.0090.00916.59
7.2.320.0120.01216.68
7.2.310.0070.01116.64
7.2.300.0090.00916.52
7.2.290.0070.01616.69
7.2.60.0090.00316.88
7.2.00.0030.00919.45
7.1.200.0080.00415.73
7.1.100.0080.00318.13
7.1.70.0070.00316.99
7.1.60.0140.01119.29
7.1.50.0070.01416.81
7.1.00.0030.06722.40
7.0.200.0680.00714.41
7.0.140.0000.07322.00
7.0.60.0000.07319.86
7.0.50.0030.06717.94
7.0.40.0070.06720.18
7.0.30.0200.05720.26
7.0.20.0270.07020.20
7.0.10.0130.05020.10
7.0.00.0100.05020.14
5.6.280.0100.06721.07
5.6.210.0030.07020.51
5.6.200.0100.06018.18
5.6.190.0030.08320.64
5.6.180.0130.07720.36
5.6.170.0200.04720.39
5.6.160.0030.04720.46
5.6.150.0070.05318.12
5.6.140.0130.04718.18
5.6.130.0070.04018.29
5.6.120.0070.05021.00
5.6.110.0100.08321.02
5.6.100.0030.05720.89
5.6.90.0130.07320.98
5.6.80.0030.03720.38
5.5.350.0070.08020.37
5.5.340.0030.08017.98
5.5.330.0070.07020.43
5.5.320.0030.04320.19
5.5.310.0330.06720.34
5.5.300.0100.03318.08
5.5.290.0030.06018.07
5.5.280.0000.07320.88
5.5.270.0100.03720.75
5.5.260.0170.07320.87
5.5.250.0030.07320.61
5.5.240.0130.08020.16
5.4.450.0700.05719.52
5.4.440.0170.06019.48
5.4.430.0300.05319.46
5.4.420.0270.04719.45
5.4.410.0230.05019.42
5.4.400.0170.05719.23
5.4.390.0230.05319.25
5.4.380.0230.05318.59
5.4.370.0000.04718.68
5.4.360.0030.04018.55
5.4.350.0070.03612.02
5.4.340.0060.03712.02
5.4.320.0030.04112.50
5.4.310.0100.03512.50
5.4.300.0090.04712.51
5.4.290.0130.04112.50
5.4.280.0090.03312.40
5.4.270.0060.03712.39
5.4.260.0030.04112.40
5.4.250.0130.04718.95
5.4.240.0130.04318.79
5.4.230.0170.04018.98
5.4.220.0000.07718.98
5.4.210.0170.04018.94
5.4.200.0030.05318.76
5.4.190.0030.05318.96
5.4.180.0030.05318.79
5.4.170.0170.06718.90
5.4.160.0030.05719.00
5.4.150.0200.05318.98
5.4.140.0070.05316.47
5.4.130.0070.07016.40
5.4.120.0030.05016.53
5.4.110.0070.05016.46
5.4.100.0130.04016.57
5.4.90.0100.07016.46
5.4.80.0070.05316.45
5.4.70.0000.05316.55
5.4.60.0070.05016.44
5.4.50.0070.04716.39
5.4.40.0030.05016.39
5.4.30.0130.04316.35
5.4.20.0030.05016.52
5.4.10.0030.07016.42
5.4.00.0070.04716.00
5.3.290.0070.04512.80
5.3.280.0030.05314.59
5.3.270.0070.05014.79
5.3.260.0000.06714.60
5.3.250.0130.04314.83
5.3.240.0070.05714.63
5.3.230.0130.04314.82
5.3.220.0100.04714.75
5.3.210.0130.04714.73
5.3.200.0070.04714.79
5.3.190.0030.05014.66
5.3.180.0030.06314.74
5.3.170.0100.04714.47
5.3.160.0100.04314.64
5.3.150.0070.05014.63
5.3.140.0030.05014.64
5.3.130.0070.05314.69
5.3.120.0100.05014.57
5.3.110.0130.05014.53
5.3.100.0030.05714.01
5.3.90.0000.05714.15
5.3.80.0070.06714.20
5.3.70.0030.05314.10
5.3.60.0100.04713.98
5.3.50.0100.06313.94
5.3.40.0030.05314.18
5.3.30.0030.05313.93
5.3.20.0100.04713.92
5.3.10.0100.04313.73
5.3.00.0030.05313.73
5.2.170.0230.05011.17
5.2.160.0070.03710.98
5.2.150.0070.03711.31
5.2.140.0030.04311.05
5.2.130.0000.04311.28
5.2.120.0000.04311.18
5.2.110.0000.04311.20
5.2.100.0100.03311.20
5.2.90.0070.03711.18
5.2.80.0030.04011.16
5.2.70.0070.04011.09
5.2.60.0070.03711.01
5.2.50.0070.03711.00
5.2.40.0070.03711.08
5.2.30.0000.04310.93
5.2.20.0070.03710.79
5.2.10.0000.04311.08
5.2.00.0030.04010.80
5.1.60.0000.03710.07
5.1.50.0100.0279.96
5.1.40.0030.0339.96
5.1.30.0000.03710.29
5.1.20.0070.03310.34
5.1.10.0000.04010.31
5.1.00.0000.04010.04
5.0.50.0030.0278.65
5.0.40.0000.0308.39
5.0.30.0000.0438.33
5.0.20.0070.0238.19
5.0.10.0030.0278.09
5.0.00.0000.0438.23
4.4.90.0000.0237.41
4.4.80.0030.0207.41
4.4.70.0100.0137.41
4.4.60.0030.0207.41
4.4.50.0070.0177.41
4.4.40.0000.0377.41
4.4.30.0100.0137.41
4.4.20.0000.0237.41
4.4.10.0030.0207.41
4.4.00.0000.0337.41
4.3.110.0000.0277.41
4.3.100.0070.0177.41
4.3.90.0030.0277.41
4.3.80.0030.0307.41
4.3.70.0070.0137.41
4.3.60.0030.0177.41
4.3.50.0000.0237.41
4.3.40.0070.0337.41
4.3.30.0000.0237.41
4.3.20.0030.0207.41
4.3.10.0000.0237.41
4.3.00.0000.0237.29

preferences:
42.46 ms | 401 KiB | 5 Q