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.60.0040.01116.63
8.3.50.0240.00522.05
8.3.40.0090.00918.55
8.3.30.0040.01118.93
8.3.20.0000.00820.04
8.3.10.0050.00323.70
8.3.00.0040.00419.26
8.2.180.0000.01518.36
8.2.170.0150.00622.96
8.2.160.0070.00719.16
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00422.08
8.2.110.0060.00322.13
8.2.100.0040.00817.72
8.2.90.0050.00317.91
8.2.80.0050.00317.97
8.2.70.0090.00017.75
8.2.60.0000.00917.80
8.2.50.0030.00518.07
8.2.40.0080.00019.95
8.2.30.0070.00318.03
8.2.20.0030.00617.60
8.2.10.0040.00417.93
8.2.00.0070.00317.67
8.1.280.0190.00325.92
8.1.270.0000.00823.83
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0060.00322.42
8.1.230.0070.00420.97
8.1.220.0000.00817.74
8.1.210.0090.00018.89
8.1.200.0090.00017.34
8.1.190.0030.00517.53
8.1.180.0030.00618.10
8.1.170.0060.00318.55
8.1.160.0040.00422.06
8.1.150.0050.00518.52
8.1.140.0000.00717.39
8.1.130.0000.00817.69
8.1.120.0070.00017.43
8.1.110.0070.00417.39
8.1.100.0070.00017.38
8.1.90.0030.00417.39
8.1.80.0040.00417.30
8.1.70.0000.00717.38
8.1.60.0040.00417.39
8.1.50.0050.00217.36
8.1.40.0080.00017.44
8.1.30.0000.00817.48
8.1.20.0000.00717.53
8.1.10.0040.00417.32
8.1.00.0040.00417.33
8.0.300.0040.00419.98
8.0.290.0060.00317.05
8.0.280.0040.00418.44
8.0.270.0030.00317.13
8.0.260.0030.00317.19
8.0.250.0030.00316.96
8.0.240.0000.00716.97
8.0.230.0030.00316.85
8.0.220.0000.00716.87
8.0.210.0090.00016.88
8.0.200.0000.00716.84
8.0.190.0000.00716.96
8.0.180.0030.00616.88
8.0.170.0050.00316.88
8.0.160.0040.00416.91
8.0.150.0030.00316.86
8.0.140.0000.00716.73
8.0.130.0000.00613.29
8.0.120.0000.00816.86
8.0.110.0000.00816.85
8.0.100.0040.00416.74
8.0.90.0040.00416.85
8.0.80.0040.01116.87
8.0.70.0000.00716.70
8.0.60.0000.00816.84
8.0.50.0050.00316.79
8.0.30.0130.00817.20
8.0.20.0120.00917.40
8.0.10.0020.00516.97
8.0.00.0120.00816.79
7.4.330.0060.00015.00
7.4.320.0070.00016.47
7.4.300.0030.00316.44
7.4.290.0000.00716.59
7.4.280.0000.00716.45
7.4.270.0070.00016.59
7.4.260.0040.00416.42
7.4.250.0070.00016.55
7.4.240.0050.00216.48
7.4.230.0070.00016.36
7.4.220.0090.01516.48
7.4.210.0100.00716.50
7.4.200.0000.00716.35
7.4.190.0000.00716.56
7.4.160.0060.00916.59
7.4.150.0060.01217.40
7.4.140.0090.01017.86
7.4.130.0110.00616.45
7.4.120.0020.01516.45
7.4.110.0100.01016.43
7.4.100.0120.00616.48
7.4.90.0000.01816.31
7.4.80.0140.00719.39
7.4.70.0150.00616.30
7.4.60.0120.00616.42
7.4.50.0070.00016.10
7.4.40.0090.00222.77
7.4.30.0080.00816.47
7.4.10.0040.01114.96
7.4.00.0020.01514.98
7.3.330.0030.00313.18
7.3.320.0050.00013.24
7.3.310.0000.00716.19
7.3.300.0040.00416.09
7.3.290.0130.00616.25
7.3.280.0090.00616.21
7.3.270.0130.00717.40
7.3.260.0110.00716.45
7.3.250.0140.00616.51
7.3.240.0120.00616.30
7.3.230.0090.01216.39
7.3.210.0100.01316.41
7.3.200.0120.00619.39
7.3.190.0100.00716.43
7.3.180.0120.00316.24
7.3.170.0090.00916.42
7.3.160.0120.00916.27
7.3.130.0060.01314.45
7.3.120.0030.01414.99
7.3.110.0030.01014.83
7.3.100.0070.01014.88
7.3.90.0060.01014.75
7.3.80.0030.01414.71
7.3.70.0030.01014.54
7.3.60.0150.00014.73
7.3.50.0100.00714.51
7.3.40.0030.00614.55
7.3.30.0080.00514.81
7.3.20.0000.01016.61
7.3.10.0110.00416.59
7.3.00.0070.01016.58
7.2.330.0060.01216.17
7.2.320.0080.00916.61
7.2.310.0100.01016.61
7.2.300.0110.01116.61
7.2.290.0060.01216.53
7.2.260.0090.01215.02
7.2.250.0030.01314.81
7.2.240.0070.00714.96
7.2.230.0100.01014.80
7.2.220.0090.00614.76
7.2.210.0100.00315.07
7.2.200.0040.01114.88
7.2.190.0030.01014.66
7.2.180.0070.01114.94
7.2.170.0030.01414.88
7.2.160.0090.00615.05
7.2.150.0070.00716.86
7.2.140.0030.00916.78
7.2.130.0120.00316.87
7.2.120.0090.00016.77
7.2.110.0070.00716.64
7.2.100.0030.01016.84
7.2.90.0040.01116.60
7.2.80.0070.00416.56
7.2.70.0060.00916.80
7.2.60.0030.00816.53
7.2.50.0040.00816.65
7.2.40.0110.00416.93
7.2.30.0000.01516.60
7.2.20.0000.01316.76
7.2.10.0070.00716.59
7.2.00.0050.00917.83
7.1.330.0090.00615.70
7.1.320.0050.01015.43
7.1.310.0000.01415.50
7.1.300.0070.01015.61
7.1.290.0120.00415.79
7.1.280.0060.00315.48
7.1.270.0000.00815.77
7.1.260.0040.01215.69
7.1.250.0000.01715.64
7.1.240.0000.01315.38
7.1.230.0040.00815.72
7.1.220.0030.01015.61
7.1.210.0000.00815.73
7.1.200.0030.00815.71
7.1.190.0070.00715.20
7.1.180.0040.00415.45
7.1.170.0040.01115.54
7.1.160.0040.01115.63
7.1.150.0030.00815.30
7.1.140.0030.01015.62
7.1.130.0040.00415.64
7.1.120.0050.00315.65
7.1.110.0040.01115.66
7.1.100.0040.00616.68
7.1.90.0100.00715.46
7.1.80.0080.00815.54
7.1.70.0030.00716.17
7.1.60.0080.00817.58
7.1.50.0070.00916.27
7.1.40.0030.00615.54
7.1.30.0070.00715.62
7.1.20.0030.00915.49
7.1.10.0090.00615.64
7.1.00.0090.03919.02
7.0.330.0030.01115.19
7.0.320.0030.01315.18
7.0.310.0060.00315.20
7.0.300.0000.01015.19
7.0.290.0080.00015.37
7.0.280.0030.00915.26
7.0.270.0100.00315.14
7.0.260.0050.00315.43
7.0.250.0000.01015.46
7.0.240.0060.00914.98
7.0.230.0030.00915.17
7.0.220.0070.00715.38
7.0.210.0030.01015.03
7.0.200.0060.00515.98
7.0.190.0030.01015.26
7.0.180.0040.00715.19
7.0.170.0000.01014.90
7.0.160.0000.00915.30
7.0.150.0030.01015.36
7.0.140.0020.04218.62
7.0.130.0000.01115.01
7.0.120.0030.00915.41
7.0.110.0030.01015.25
7.0.100.0100.00315.18
7.0.90.0030.01015.13
7.0.80.0060.00615.39
7.0.70.0070.00715.14
7.0.60.0020.03017.47
7.0.50.0050.04516.41
7.0.40.0100.04516.75
7.0.30.0170.04716.91
7.0.20.0170.02316.79
7.0.10.0080.02616.78
7.0.00.0120.04016.71
5.6.400.0120.00613.90
5.6.390.0030.00614.02
5.6.380.0040.00713.90
5.6.370.0030.01113.84
5.6.360.0090.00314.04
5.6.350.0000.01314.34
5.6.340.0090.00914.21
5.6.330.0040.00813.97
5.6.320.0040.01114.04
5.6.310.0120.00314.19
5.6.300.0030.00814.13
5.6.290.0030.00613.73
5.6.280.0090.03517.65
5.6.270.0090.00014.22
5.6.260.0060.00614.07
5.6.250.0000.00914.09
5.6.240.0100.00014.45
5.6.230.0060.01014.09
5.6.220.0050.00313.80
5.6.210.0050.04417.13
5.6.200.0050.04516.10
5.6.190.0050.02517.35
5.6.180.0130.04117.30
5.6.170.0100.05017.18
5.6.160.0080.04517.24
5.6.150.0090.03815.97
5.6.140.0100.04016.16
5.6.130.0050.03216.26
5.6.120.0030.04917.57
5.6.110.0070.02917.52
5.6.100.0080.03717.61
5.6.90.0050.04817.49
5.6.80.0080.04017.17
5.6.70.1870.02217.29
5.6.60.0060.00314.12
5.6.50.0090.00413.95
5.6.40.0090.00314.13
5.6.30.0030.00613.91
5.6.20.0090.00614.19
5.6.10.0070.00414.01
5.6.00.0090.00614.12
5.5.380.0040.00813.78
5.5.370.0120.00413.79
5.5.360.0040.01314.01
5.5.350.0070.04617.15
5.5.340.0100.04315.89
5.5.330.0110.04717.28
5.5.320.0160.04817.17
5.5.310.0240.04017.30
5.5.300.0080.05116.04
5.5.290.0110.04116.02
5.5.280.0140.02817.49
5.5.270.0130.04717.41
5.5.260.0090.04617.52
5.5.250.0100.04617.36
5.5.240.0120.03216.92
5.5.230.0090.00913.74
5.5.220.0030.01013.71
5.5.210.0030.01013.94
5.5.200.0120.00313.69
5.5.190.0040.01113.46
5.5.180.0070.00713.69
5.5.170.0000.01513.58
5.5.160.0070.00413.83
5.5.150.0030.01313.82
5.5.140.0070.00713.79
5.5.130.0060.00613.98
5.5.120.0070.00713.93
5.5.110.0070.00413.54
5.5.100.0120.00314.02
5.5.90.0040.00813.79
5.5.80.0000.01714.06
5.5.70.0050.01414.13
5.5.60.0070.01013.96
5.5.50.0110.00814.00
5.5.40.0110.00613.65
5.5.30.0120.00913.89
5.5.20.0090.00914.00
5.5.10.0120.00413.65
5.5.00.0070.01313.91
5.4.450.0400.04314.98
5.4.440.0600.02815.06
5.4.430.0140.03615.18
5.4.420.0370.03915.27
5.4.410.0400.03414.88
5.4.400.0140.02714.88
5.4.390.0250.02914.98
5.4.380.0320.03414.73
5.4.370.0230.03014.83
5.4.360.0150.03414.77
5.4.350.0150.03414.78
5.4.340.0240.02614.77
5.4.330.0030.00310.61
5.4.320.0080.02211.69
5.4.310.0060.01811.58
5.4.300.0090.02011.40
5.4.290.0040.02211.59
5.4.280.0050.02011.49
5.4.270.0050.02211.62
5.4.260.0040.02411.54
5.4.250.0100.02511.55
5.4.240.0040.02911.51
5.4.230.0060.03011.54
5.4.220.0080.02611.46
5.4.210.0090.02211.30
5.4.200.0060.02911.46
5.4.190.0050.02311.53
5.4.180.0040.03311.39
5.4.170.0080.03011.51
5.4.160.0040.02511.63
5.4.150.0070.02711.54
5.4.140.0070.02611.42
5.4.130.0040.02211.31
5.4.120.0080.02011.25
5.4.110.0040.02311.49
5.4.100.0060.02211.20
5.4.90.0080.02311.33
5.4.80.0050.02311.41
5.4.70.0020.02411.41
5.4.60.0060.02411.17
5.4.50.0050.02911.24
5.4.40.0040.02711.23
5.4.30.0050.02611.30
5.4.20.0100.02011.38
5.4.10.0090.02211.50
5.4.00.0090.02511.25
5.3.290.0070.02511.62
5.3.280.0070.03111.49
5.3.270.0080.02311.52
5.3.260.0070.02411.56
5.3.250.0040.02711.56
5.3.240.0100.02111.37
5.3.230.0040.02311.53
5.3.220.0040.02611.52
5.3.210.0070.03011.48
5.3.200.0100.02611.48
5.3.190.0060.02911.38
5.3.180.0090.02811.58
5.3.170.0060.03011.53
5.3.160.0080.02911.57
5.3.150.0080.03111.46
5.3.140.0070.02611.46
5.3.130.0030.03111.53
5.3.120.0090.02411.40
5.3.110.0060.02811.53
5.3.100.0040.03211.27
5.3.90.0080.02711.33
5.3.80.0020.03111.17
5.3.70.0050.03011.21
5.3.60.0060.03211.21
5.3.50.0070.03011.07
5.3.40.0100.02711.13
5.3.30.0060.02711.14
5.3.20.0100.02110.91
5.3.10.0070.02310.96
5.3.00.0050.02410.79
5.2.170.0050.0339.23
5.2.160.0040.0429.23
5.2.150.0090.0399.23
5.2.140.0110.0389.23
5.2.130.0090.0439.19
5.2.120.0030.0379.18
5.2.110.0070.0369.19
5.2.100.0090.0379.19
5.2.90.0130.0359.19
5.2.80.0080.0409.19
5.2.70.0080.0329.19
5.2.60.0050.0359.13
5.2.50.0080.0349.10
5.2.40.0080.0309.08
5.2.30.0100.0319.07
5.2.20.0070.0319.04
5.2.10.0060.0338.95
5.2.00.0100.0308.82
5.1.60.0120.0218.09
5.1.50.0090.0328.09
5.1.40.0040.0388.08
5.1.30.0090.0368.43
5.1.20.0080.0348.45
5.1.10.0060.0378.17
5.1.00.0060.0418.17
5.0.50.0060.0346.66
5.0.40.0030.0346.51
5.0.30.0070.0466.32
5.0.20.0040.0316.29
5.0.10.0060.0286.27
5.0.00.0070.0396.26
4.4.90.0060.0194.78
4.4.80.0040.0214.75
4.4.70.0050.0194.75
4.4.60.0090.0174.76
4.4.50.0050.0214.77
4.4.40.0030.0364.71
4.4.30.0040.0224.76
4.4.20.0050.0224.85
4.4.10.0030.0224.85
4.4.00.0060.0334.75
4.3.110.0050.0194.66
4.3.100.0030.0244.66
4.3.90.0030.0224.63
4.3.80.0040.0334.59
4.3.70.0040.0224.63
4.3.60.0060.0224.63
4.3.50.0030.0254.63
4.3.40.0050.0324.54
4.3.30.0040.0213.30
4.3.20.0060.0223.28
4.3.10.0070.0213.24
4.3.00.0070.01313.47

preferences:
43.49 ms | 401 KiB | 5 Q