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 __toString() { 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.70.0120.00918.43
8.3.60.0130.00918.43
8.3.50.0110.00821.86
8.3.40.0070.01318.63
8.3.30.0100.00418.74
8.3.20.0000.00820.16
8.3.10.0090.00021.89
8.3.00.0040.00419.38
8.2.180.0040.01118.41
8.2.170.0070.00722.96
8.2.160.0100.00320.42
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0110.00326.16
8.2.120.0030.00522.25
8.2.110.0040.00422.25
8.2.100.0110.00017.66
8.2.90.0000.00819.17
8.2.80.0040.00417.97
8.2.70.0070.00417.50
8.2.60.0000.00717.91
8.2.50.0030.00518.07
8.2.40.0030.00519.76
8.2.30.0040.00417.88
8.2.20.0000.00817.75
8.2.10.0040.00418.00
8.2.00.0050.00317.65
8.1.280.0070.00725.92
8.1.270.0080.00023.71
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0080.00023.98
8.1.230.0040.00719.22
8.1.220.0080.00017.74
8.1.210.0090.00018.77
8.1.200.0030.00617.23
8.1.190.0030.00517.41
8.1.180.0060.00318.10
8.1.170.0090.00018.63
8.1.160.0040.00421.86
8.1.150.0060.00618.63
8.1.140.0000.00717.35
8.1.130.0000.00717.75
8.1.120.0040.00417.36
8.1.110.0050.00517.23
8.1.100.0050.00317.22
8.1.90.0000.00817.27
8.1.80.0030.00317.41
8.1.70.0000.00817.37
8.1.60.0030.00617.41
8.1.50.0050.00317.34
8.1.40.0000.00817.53
8.1.30.0080.00017.56
8.1.20.0000.00717.56
8.1.10.0000.00717.27
8.1.00.0030.00617.32
8.0.300.0070.00020.78
8.0.290.0040.00417.18
8.0.280.0000.00718.38
8.0.270.0000.00717.19
8.0.260.0000.00617.10
8.0.250.0070.00016.96
8.0.240.0000.00816.82
8.0.230.0050.00216.92
8.0.220.0030.00316.92
8.0.210.0000.00716.88
8.0.200.0050.00316.98
8.0.190.0000.00816.91
8.0.180.0020.00516.92
8.0.170.0080.00016.83
8.0.160.0030.00316.93
8.0.150.0030.00516.86
8.0.140.0000.00716.88
8.0.130.0030.00513.31
8.0.120.0040.00416.81
8.0.110.0040.00416.73
8.0.100.0000.00716.82
8.0.90.0050.00216.76
8.0.80.0030.01316.78
8.0.70.0030.00316.84
8.0.60.0000.00716.80
8.0.50.0000.00716.72
8.0.30.0080.01217.05
8.0.20.0150.00317.40
8.0.10.0020.00516.96
8.0.00.0090.00816.88
7.4.330.0060.00015.00
7.4.320.0030.00316.53
7.4.300.0000.00616.39
7.4.290.0000.00716.54
7.4.280.0030.00316.44
7.4.270.0030.00316.56
7.4.260.0030.00316.53
7.4.250.0050.00216.50
7.4.240.0020.00516.60
7.4.230.0000.00716.20
7.4.220.0090.01016.50
7.4.210.0120.00416.51
7.4.200.0040.00416.61
7.4.190.0000.00716.58
7.4.160.0030.01316.34
7.4.150.0050.01417.40
7.4.140.0070.01317.86
7.4.130.0090.00916.53
7.4.120.0170.00516.53
7.4.110.0080.01216.57
7.4.100.0120.00616.23
7.4.90.0100.00716.62
7.4.80.0070.01319.39
7.4.70.0130.01016.51
7.4.60.0080.00816.48
7.4.50.0080.00016.29
7.4.40.0040.01522.77
7.4.30.0140.00716.37
7.4.00.0060.01014.64
7.3.330.0000.00613.16
7.3.320.0050.00013.23
7.3.310.0030.00316.19
7.3.300.0080.00016.24
7.3.290.0030.01316.25
7.3.280.0090.00716.23
7.3.270.0120.00617.40
7.3.260.0170.01716.51
7.3.250.0100.00716.26
7.3.240.0000.01716.35
7.3.230.0060.01016.39
7.3.210.0120.00616.20
7.3.200.0190.00319.39
7.3.190.0090.00916.30
7.3.180.0040.01116.35
7.3.170.0070.01416.32
7.3.160.0130.00316.23
7.3.120.0060.01214.39
7.2.330.0140.00716.37
7.2.320.0100.01016.48
7.2.310.0090.00916.53
7.2.300.0070.01016.37
7.2.290.0130.01016.38
7.2.60.0040.00816.85
7.2.00.0140.00019.14
7.1.200.0080.00815.45
7.1.100.0000.01117.70
7.1.70.0140.00716.78
7.1.60.0030.02119.46
7.1.50.0090.00316.88
7.1.00.0000.07722.44
7.0.200.0040.00416.63
7.0.140.0070.07021.94
7.0.60.0170.07319.89
7.0.50.0070.03717.88
7.0.40.0030.04720.26
7.0.30.0530.04720.12
7.0.20.0270.08320.06
7.0.10.0030.08320.06
7.0.00.0200.06020.05
5.6.280.0070.07021.00
5.6.210.0100.06720.73
5.6.200.0030.04018.23
5.6.190.0030.06720.63
5.6.180.0200.07720.41
5.6.170.0330.06020.55
5.6.160.0100.07020.56
5.6.150.0100.04318.15
5.6.140.0030.04018.18
5.6.130.0070.08018.14
5.6.120.0070.08721.15
5.6.110.0030.04020.90
5.6.100.0030.05320.94
5.6.90.0030.05021.13
5.6.80.0070.07720.51
5.5.350.0200.04320.32
5.5.340.0100.08018.04
5.5.330.0230.06020.40
5.5.320.0330.07320.36
5.5.310.0200.04020.27
5.5.300.0100.04017.92
5.5.290.0070.08718.07
5.5.280.0100.07320.88
5.5.270.0030.07020.89
5.5.260.0070.08720.96
5.5.250.0130.08020.69
5.5.240.4600.03020.16
5.4.450.0630.06019.37
5.4.440.1000.05319.57
5.4.430.0200.04719.18
5.4.420.0730.07319.16
5.4.410.0130.05019.34
5.4.400.0600.06319.26
5.4.390.0930.06319.30
5.4.380.0300.05018.79
5.4.370.0330.05018.74
5.4.360.0170.06318.76
5.4.350.0170.06018.59
5.4.340.0330.05318.72
5.4.320.0070.04612.50
5.4.310.0060.04312.50
5.4.300.0050.03812.51
5.4.290.0040.04712.48
5.4.280.0090.03412.38
5.4.270.0060.03812.38
5.4.260.0060.03912.38
5.4.250.0040.04112.38
5.4.240.0060.05612.38
5.4.230.0080.05712.38
5.4.220.0110.05012.38
5.4.210.0100.05412.38
5.4.200.0090.03912.38
5.4.190.0080.04412.38
5.4.180.0090.04012.37
5.4.170.0080.04212.39
5.4.160.0080.05412.38
5.4.150.0080.05012.38
5.4.140.0070.05312.05
5.4.130.0060.05112.05
5.4.120.0180.08212.00
5.4.110.0050.05012.00
5.4.100.0040.05112.00
5.4.90.0100.04512.00
5.4.80.0100.04612.00
5.4.70.0130.04312.00
5.4.60.0100.04511.99
5.4.50.0140.04412.00
5.4.40.0060.05411.98
5.4.30.0100.04711.98
5.4.20.0140.05911.98
5.4.10.0120.04511.98
5.4.00.0070.05511.47
5.3.290.0090.04612.80
5.3.280.0080.05212.71
5.3.270.0090.05112.72
5.3.260.0080.05812.72
5.3.250.0080.05512.72
5.3.240.0050.05712.72
5.3.230.0170.07012.71
5.3.220.0150.04012.68
5.3.210.0090.04512.68
5.3.200.0050.04412.68
5.3.190.0110.05112.68
5.3.180.0090.04112.67
5.3.170.0080.04812.67
5.3.160.0080.05412.68
5.3.150.0100.04812.67
5.3.140.0100.05112.66
5.3.130.0050.04612.66
5.3.120.0080.04112.66
5.3.110.0090.04412.66
5.3.100.0050.04012.13
5.3.90.0060.04512.11
5.3.80.0050.03712.10
5.3.70.0070.03712.10
5.3.60.0060.03812.08
5.3.50.0060.03812.03
5.3.40.0070.03612.03
5.3.30.0060.03511.99
5.3.20.0040.03811.78
5.3.10.0090.03211.74
5.3.00.0060.03611.72
5.2.170.0070.0309.23
5.2.160.0080.0309.23
5.2.150.0020.0339.23
5.2.140.0040.0329.22
5.2.130.0060.0369.18
5.2.120.0040.0359.18
5.2.110.0090.0549.20
5.2.100.0090.0459.20
5.2.90.0060.0529.19
5.2.80.0040.0479.19
5.2.70.0080.0439.19
5.2.60.0090.0429.14
5.2.50.0060.0459.10
5.2.40.0090.0359.08
5.2.30.0070.0419.06
5.2.20.0090.0459.04
5.2.10.0090.0458.95
5.2.00.0110.0368.82
5.1.60.0100.0408.10
5.1.50.0030.0368.09
5.1.40.0080.0348.08
5.1.30.0080.0358.43
5.1.20.0040.0308.45
5.1.10.0070.0238.17
5.1.00.0060.0238.17
5.0.50.0050.0196.66
5.0.40.0030.0196.51
5.0.30.0050.0326.32
5.0.20.0030.0326.29
5.0.10.0070.0296.27
5.0.00.0070.0366.26
4.4.90.0030.0204.78
4.4.80.0020.0254.75
4.4.70.0040.0214.75
4.4.60.0040.0214.76
4.4.50.0080.0304.77
4.4.40.0040.0354.71
4.4.30.0000.0264.75
4.4.20.0040.0194.84
4.4.10.0010.0204.85
4.4.00.0050.0244.76
4.3.110.0030.0184.67
4.3.100.0050.0134.66
4.3.90.0040.0234.63
4.3.80.0040.0564.58
4.3.70.0050.0234.63
4.3.60.0040.0214.63
4.3.50.0050.0224.62
4.3.40.0040.0334.54
4.3.30.0040.0233.30
4.3.20.0030.0203.28
4.3.10.0040.0203.23
4.3.00.0070.02310.54

preferences:
36.03 ms | 401 KiB | 5 Q