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 { function get(){ $something = new Answer(); $something->the(); } function the(){ } 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.0110.00418.55
8.3.50.0070.01421.27
8.3.40.0040.01118.80
8.3.30.0100.00320.33
8.3.20.0000.00720.34
8.3.10.0070.00021.95
8.3.00.0080.00022.43
8.2.180.0100.01016.88
8.2.170.0050.01022.96
8.2.160.0170.00320.35
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0140.00026.16
8.2.120.0040.00719.43
8.2.110.0060.00322.11
8.2.100.0090.00317.84
8.2.90.0030.00619.17
8.2.80.0040.00419.34
8.2.70.0030.00617.63
8.2.60.0050.00317.68
8.2.50.0000.00818.07
8.2.40.0060.00318.03
8.2.30.0070.00418.09
8.2.20.0000.00717.78
8.2.10.0080.00017.76
8.2.00.0000.00817.62
8.1.280.0040.01125.92
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00723.83
8.1.230.0110.00018.97
8.1.220.0050.00317.74
8.1.210.0000.00818.77
8.1.200.0060.00317.48
8.1.190.0080.00017.27
8.1.180.0040.00419.26
8.1.170.0030.00618.50
8.1.160.0040.00422.15
8.1.150.0000.00718.64
8.1.140.0000.00917.36
8.1.130.0070.00017.76
8.1.120.0030.00517.43
8.1.110.0040.00417.40
8.1.100.0000.00817.31
8.1.90.0000.00717.44
8.1.80.0070.00017.46
8.1.70.0040.00417.41
8.1.60.0000.00917.55
8.1.50.0040.00417.50
8.1.40.0030.00617.43
8.1.30.0030.00617.52
8.1.20.0030.00517.54
8.1.10.0050.00217.48
8.1.00.0000.00817.39
8.0.300.0040.00418.77
8.0.290.0030.00317.05
8.0.280.0030.00518.44
8.0.270.0030.00317.20
8.0.260.0030.00316.90
8.0.250.0000.00717.03
8.0.240.0030.00616.98
8.0.230.0030.00316.93
8.0.220.0030.00316.87
8.0.210.0030.00316.87
8.0.200.0000.00717.00
8.0.190.0080.00017.02
8.0.180.0050.00216.98
8.0.170.0090.00016.95
8.0.160.0000.00716.86
8.0.150.0040.00416.94
8.0.140.0000.00716.87
8.0.130.0060.00013.39
8.0.120.0030.00516.94
8.0.110.0050.00316.86
8.0.100.0050.00216.86
8.0.90.0070.00016.96
8.0.80.0110.01016.94
8.0.70.0000.00717.02
8.0.60.0000.00717.02
8.0.50.0040.00416.97
8.0.30.0100.00917.17
8.0.20.0110.01317.40
8.0.10.0000.00716.97
8.0.00.0130.00516.86
7.4.330.0050.00015.00
7.4.320.0000.00616.50
7.4.300.0060.00016.41
7.4.290.0030.00616.45
7.4.280.0030.00316.60
7.4.270.0000.00716.61
7.4.260.0070.00016.35
7.4.250.0000.00716.33
7.4.240.0030.00416.54
7.4.230.0000.00716.63
7.4.220.0030.01816.61
7.4.210.0090.01016.54
7.4.200.0000.00716.39
7.4.190.0030.00316.61
7.4.160.0030.01316.50
7.4.150.0150.00717.40
7.4.140.0100.01017.86
7.4.130.0110.00916.64
7.4.120.0070.01016.51
7.4.110.0060.01216.53
7.4.100.0070.01416.56
7.4.90.0030.01516.58
7.4.80.0130.00619.39
7.4.70.0150.00316.39
7.4.60.0070.01016.55
7.4.50.0040.00416.55
7.4.40.0080.00722.77
7.4.30.0140.00716.65
7.4.00.0080.00814.88
7.3.330.0050.00013.32
7.3.320.0000.00613.23
7.3.310.0040.00416.21
7.3.300.0070.00016.36
7.3.290.0130.00716.32
7.3.280.0110.00816.37
7.3.270.0030.01317.40
7.3.260.0090.00916.36
7.3.250.0080.00916.49
7.3.240.0130.00616.31
7.3.230.0070.01116.39
7.3.210.0050.01516.46
7.3.200.0080.00919.39
7.3.190.0120.00616.49
7.3.180.0090.01016.31
7.3.170.0050.01416.41
7.3.160.0090.00716.30
7.3.120.0100.00714.89
7.2.330.0140.00316.36
7.2.320.0110.01116.69
7.2.310.0070.01016.44
7.2.300.0110.00716.76
7.2.290.0170.00716.43
7.2.60.0230.00516.79
7.2.00.0100.00719.09
7.1.200.0130.00315.71
7.1.70.0000.00817.08
7.1.60.0030.00817.23
7.1.50.0230.01734.87
7.1.00.0000.03722.44
7.0.200.0030.00316.48
7.0.140.0170.06321.93
7.0.110.0130.04319.93
7.0.100.0070.07720.04
7.0.90.0100.07719.99
7.0.80.0100.07719.88
7.0.70.0030.04720.04
7.0.60.0130.08019.90
7.0.50.0070.08020.01
7.0.40.0100.05019.55
7.0.30.0030.08719.82
7.0.20.0130.07319.68
7.0.10.0070.07719.58
7.0.00.0070.08319.73
5.6.280.0000.07721.11
5.6.260.0130.07320.64
5.6.250.0170.07020.61
5.6.240.0100.07720.66
5.6.230.0230.06720.64
5.6.220.0130.08020.51
5.6.210.0100.07320.60
5.6.200.0070.05020.52
5.6.190.0230.06720.66
5.6.180.0030.08320.66
5.6.170.0070.07720.53
5.6.160.0100.08020.55
5.6.150.0070.08320.63
5.6.140.0070.09020.60
5.6.130.0070.08320.55
5.6.120.0070.08020.60
5.6.110.0130.07720.61
5.6.100.0070.07720.65
5.6.90.0070.06020.64
5.6.80.0030.08719.90
5.6.70.0030.08719.96
5.6.60.0070.08319.90
5.6.50.0100.07020.05
5.6.40.0100.07320.02
5.6.30.0100.05019.86
5.6.20.0130.07319.87
5.6.10.0100.07320.02
5.6.00.0030.08719.83
5.5.380.0030.08020.54
5.5.370.0130.07320.34
5.5.360.0130.07020.21
5.5.350.0070.08020.43
5.5.340.0030.08020.74
5.5.330.0030.08020.77
5.5.320.0070.08020.70
5.5.310.0130.06320.72
5.5.300.0100.07720.84
5.5.290.0170.07020.76
5.5.280.0070.07320.84
5.5.270.0100.08020.93
5.5.260.0030.08720.75
5.5.250.0130.07320.73
5.5.240.0100.04320.36
5.5.230.0170.03720.03
5.5.220.0000.08020.34
5.5.210.0100.04720.32
5.5.200.0200.06320.18
5.5.190.0100.07720.20
5.5.180.0070.04720.11
5.5.160.0070.04720.32
5.5.150.0070.07020.08
5.5.140.0070.08020.04
5.5.130.0100.07320.26
5.5.120.0100.07720.29
5.5.110.0070.07720.00
5.5.100.0000.05320.16
5.5.90.0070.07019.93
5.5.80.0000.08020.15
5.5.70.0030.08020.20
5.5.60.0130.06019.92
5.5.50.0070.07020.09
5.5.40.0130.07319.98
5.5.30.0070.07719.98
5.5.20.0270.05719.94
5.5.10.0100.03320.02
5.5.00.0030.07020.09
5.4.450.0000.05319.46
5.4.440.0130.07019.51
5.4.430.0000.05319.48
5.4.420.0130.07319.46
5.4.410.0070.06019.14
5.4.400.0270.05318.99
5.4.390.0070.07719.21
5.4.380.0170.06719.31
5.4.370.0100.07319.23
5.4.360.0130.07319.09
5.4.350.0030.04719.18
5.4.340.0070.08019.11
5.4.320.0100.07318.99
5.4.310.0100.07019.02
5.4.300.0200.06018.99
5.4.290.0070.07718.99
5.4.280.0070.07719.18
5.4.270.0030.07719.09
5.4.260.0030.05019.00
5.4.250.0030.08019.18
5.4.240.0070.07319.18
5.4.230.0070.05019.33
5.4.220.0030.08319.16
5.4.210.0100.05719.16
5.4.200.0030.08019.22
5.4.190.0070.07719.00
5.4.180.0030.04719.20
5.4.170.0100.07018.99
5.4.160.0100.07319.29
5.4.150.0070.07318.93
5.4.140.0070.04316.35
5.4.130.0070.06316.43
5.4.120.0070.03716.63
5.4.110.0030.08016.56
5.4.100.0030.07316.61
5.4.90.0070.07016.56
5.4.80.0100.07316.30
5.4.70.0000.08016.58
5.4.60.0100.07316.40
5.4.50.0130.07016.56
5.4.40.0100.07016.49
5.4.30.0200.05716.41
5.4.20.0130.07016.49
5.4.10.0100.07016.29
5.4.00.0070.07315.96
5.3.290.0030.07314.70
5.3.280.0170.06314.64
5.3.270.0030.07014.75
5.3.260.0070.07714.57
5.3.250.0030.07714.63
5.3.240.0070.07714.61
5.3.230.0070.06314.68
5.3.220.0130.06714.58
5.3.210.0000.06714.43
5.3.200.0170.06714.71
5.3.190.0100.07314.55
5.3.180.0130.06714.70
5.3.170.0070.07314.43
5.3.160.0070.07714.57
5.3.150.0030.07714.71
5.3.140.0130.06314.54
5.3.130.0170.07014.41
5.3.120.0000.05014.55
5.3.110.0100.07314.55
5.3.100.0030.07013.90
5.3.90.0070.07314.04
5.3.80.0000.08014.05
5.3.70.0100.07314.09
5.3.60.0100.06714.09
5.3.50.0100.07313.82
5.3.40.0100.04013.81
5.3.30.0030.07713.87
5.3.20.0130.06313.68
5.3.10.0070.07013.88
5.3.00.0130.06713.72
5.2.170.0070.05712.08
5.2.160.0070.03012.08
5.2.150.0130.05312.08
5.2.140.0070.06012.08
5.2.130.0070.06312.08
5.2.120.0130.05312.08
5.2.110.0200.04712.08
5.2.100.0100.05712.08
5.2.90.0100.05712.08
5.2.80.0000.04012.08
5.2.70.0070.06312.08
5.2.60.0070.03312.08
5.2.50.0000.06012.08
5.2.40.0170.03712.08
5.2.30.0030.05712.08
5.2.20.0030.06012.08
5.2.10.0100.05712.08
5.2.00.0070.03312.08
5.1.60.0070.03012.08
5.1.50.0070.04712.08
5.1.40.0070.05012.08
5.1.30.0030.06012.08
5.1.20.0000.03712.08
5.1.10.0030.05712.08
5.1.00.0100.05012.08
5.0.50.0030.04012.08
5.0.40.0000.04312.08
5.0.30.0000.06312.08
5.0.20.0030.04012.08
5.0.10.0030.04012.08
5.0.00.0070.06012.08
4.4.90.0070.03012.08
4.4.80.0000.03712.08
4.4.70.0070.03012.08
4.4.60.0070.03012.08
4.4.50.0000.03712.08
4.4.40.0070.04712.08
4.4.30.0030.02012.08
4.4.20.0030.03012.08
4.4.10.0030.03712.08
4.4.00.0030.05712.08
4.3.110.0000.02012.08
4.3.100.0000.03712.08
4.3.90.0070.03012.08
4.3.80.0030.05312.08
4.3.70.0000.03712.08
4.3.60.0070.03312.08
4.3.50.0030.03312.08
4.3.40.0030.05012.08
4.3.30.0030.03312.08
4.3.20.0000.03712.08
4.3.10.0030.03012.08
4.3.00.0030.03312.08

preferences:
48.18 ms | 401 KiB | 5 Q