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(){ return the(); } function the(){ return 4; } 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.0070.00718.18
8.3.50.0120.00821.02
8.3.40.0060.00918.64
8.3.30.0070.00720.38
8.3.20.0040.00420.04
8.3.10.0080.00022.05
8.3.00.0080.00022.43
8.2.180.0140.00716.88
8.2.170.0070.00722.96
8.2.160.0090.00620.44
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0130.00726.16
8.2.120.0070.00417.91
8.2.110.0090.00022.05
8.2.100.0090.00319.64
8.2.90.0030.00619.08
8.2.80.0050.00319.21
8.2.70.0030.00617.75
8.2.60.0040.00417.90
8.2.50.0030.00618.07
8.2.40.0030.00518.09
8.2.30.0000.00717.97
8.2.20.0080.00017.80
8.2.10.0040.00417.71
8.2.00.0080.00017.75
8.1.280.0070.00725.92
8.1.270.0040.00424.66
8.1.260.0050.00226.35
8.1.250.0100.00328.09
8.1.240.0040.00423.98
8.1.230.0040.00719.04
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0060.00617.47
8.1.190.0080.00017.66
8.1.180.0080.00018.90
8.1.170.0040.00418.58
8.1.160.0000.00822.01
8.1.150.0070.00018.65
8.1.140.0070.00017.50
8.1.130.0070.00017.91
8.1.120.0050.00317.54
8.1.110.0040.00417.45
8.1.100.0040.00417.49
8.1.90.0050.00317.35
8.1.80.0000.00717.36
8.1.70.0000.00717.43
8.1.60.0090.00017.49
8.1.50.0000.00717.55
8.1.40.0000.00817.51
8.1.30.0000.00717.56
8.1.20.0040.00417.66
8.1.10.0020.00517.59
8.1.00.0070.00017.41
8.0.300.0040.00418.77
8.0.290.0070.00017.15
8.0.280.0030.00318.45
8.0.270.0000.00717.18
8.0.260.0000.00716.89
8.0.250.0000.00716.97
8.0.240.0040.00417.08
8.0.230.0070.00017.05
8.0.220.0040.00416.98
8.0.210.0030.00316.89
8.0.200.0000.00617.00
8.0.190.0040.00417.09
8.0.180.0040.00417.00
8.0.170.0050.00317.02
8.0.160.0030.00316.99
8.0.150.0070.00016.95
8.0.140.0050.00216.96
8.0.130.0000.00513.42
8.0.120.0020.00516.91
8.0.110.0050.00316.99
8.0.100.0000.00816.85
8.0.90.0070.00016.95
8.0.80.0100.00717.00
8.0.70.0000.00716.86
8.0.60.0000.00817.01
8.0.50.0040.00416.93
8.0.30.0150.00716.96
8.0.20.0080.00917.41
8.0.10.0000.00717.04
8.0.00.0100.00816.87
7.4.330.0050.00015.00
7.4.320.0000.00816.52
7.4.300.0000.00616.52
7.4.290.0030.00716.52
7.4.280.0070.00016.53
7.4.270.0050.00316.61
7.4.260.0070.00016.51
7.4.250.0040.00416.43
7.4.240.0020.00516.51
7.4.230.0030.00316.42
7.4.220.0090.00616.61
7.4.210.0060.00816.57
7.4.200.0000.00716.60
7.4.190.0030.00316.49
7.4.160.0030.01316.62
7.4.150.0040.01517.40
7.4.140.0060.01217.86
7.4.130.0080.01116.61
7.4.120.0070.01016.54
7.4.110.0070.01316.57
7.4.100.0070.01416.60
7.4.90.0080.00916.51
7.4.80.0070.01119.39
7.4.70.0110.00716.63
7.4.60.0100.00716.53
7.4.50.0050.00016.38
7.4.40.0100.00622.77
7.4.30.0130.00616.59
7.4.00.0040.01114.88
7.3.330.0000.00513.22
7.3.320.0030.00313.35
7.3.310.0020.00516.38
7.3.300.0070.00016.41
7.3.290.0070.00716.39
7.3.280.0050.01316.29
7.3.270.0110.01117.40
7.3.260.0060.01016.25
7.3.250.0120.00516.56
7.3.240.0130.00416.40
7.3.230.0090.00916.44
7.3.210.0080.00816.55
7.3.200.0120.02119.39
7.3.190.0140.00316.44
7.3.180.0150.00616.61
7.3.170.0060.00916.36
7.3.160.0090.00616.53
7.3.120.0100.00717.15
7.3.110.0030.01317.15
7.3.100.0040.01117.15
7.3.90.0030.01017.15
7.3.80.0000.01417.15
7.3.70.0110.00617.15
7.3.60.0060.00317.15
7.3.50.0000.01217.15
7.3.40.0070.00717.15
7.3.30.0070.01017.15
7.3.20.0000.01617.15
7.3.10.0000.01216.93
7.3.00.0050.01016.76
7.2.330.0030.01416.78
7.2.320.0100.01016.54
7.2.310.0030.01316.73
7.2.300.0150.00616.42
7.2.290.0100.01416.61
7.2.240.0100.00717.15
7.2.230.0070.01017.15
7.2.220.0030.01317.15
7.2.210.0070.01017.15
7.2.200.0110.00317.15
7.2.190.0080.00817.15
7.2.180.0100.00617.15
7.2.170.0030.01417.15
7.2.160.0150.00017.15
7.2.150.0110.00417.15
7.2.140.0040.01417.15
7.2.130.0040.01016.92
7.2.120.0100.00616.89
7.2.110.0060.01116.99
7.2.100.0080.00716.96
7.2.90.0070.01017.05
7.2.80.0070.00717.00
7.2.70.0070.00617.04
7.2.60.0070.00816.92
7.2.50.0060.00816.92
7.2.40.0080.00817.00
7.2.30.0040.00916.90
7.2.20.0100.00316.99
7.2.10.0090.00516.93
7.2.00.0070.00817.53
7.1.330.0060.00617.15
7.1.320.0070.00717.15
7.1.310.0100.00717.15
7.1.300.0100.00317.15
7.1.290.0100.00317.15
7.1.280.0030.01317.15
7.1.270.0060.00917.15
7.1.260.0030.01317.15
7.1.250.0090.00716.29
7.1.240.0140.00315.80
7.1.230.0130.00615.72
7.1.220.0140.00315.72
7.1.210.0080.01215.78
7.1.200.0030.01015.82
7.1.190.0120.00615.60
7.1.180.0150.00315.71
7.1.170.0120.00415.94
7.1.160.0150.00615.86
7.1.150.0100.00715.56
7.1.140.0060.00915.59
7.1.130.0090.00615.77
7.1.120.0070.00715.50
7.1.110.0120.00315.43
7.1.100.0070.00816.72
7.1.90.0140.00315.23
7.1.80.0110.00815.89
7.1.70.0050.00816.33
7.1.60.0060.01117.57
7.1.50.0060.01516.15
7.1.40.0110.00715.46
7.1.30.0090.00315.87
7.1.20.0120.00015.68
7.1.10.0130.00315.89
7.1.00.0050.02019.05
7.0.330.0100.00315.19
7.0.320.0040.00815.28
7.0.310.0070.00715.16
7.0.300.0130.00315.49
7.0.290.0030.00915.27
7.0.280.0110.00415.33
7.0.270.0100.00715.12
7.0.260.0070.00715.42
7.0.250.0070.00715.34
7.0.240.0130.00315.40
7.0.230.0150.00015.38
7.0.220.0140.00415.32
7.0.210.0150.00315.39
7.0.200.0430.01015.81
7.0.190.0060.00615.44
7.0.180.0110.00615.54
7.0.170.0120.00615.26
7.0.160.0180.00015.34
7.0.150.0120.00615.53
7.0.140.0120.03518.67
7.0.130.0100.00315.25
7.0.120.0110.00615.36
7.0.110.0080.00815.40
7.0.100.0110.02017.67
7.0.90.0060.02117.68
7.0.80.0060.02417.76
7.0.70.0030.02317.52
7.0.60.0050.02417.74
7.0.50.0200.04018.00
7.0.40.0020.02916.68
7.0.30.0080.04016.68
7.0.20.0060.04616.67
7.0.10.0030.03516.71
7.0.00.0100.04316.73
5.6.380.0060.00614.28
5.6.370.0030.01014.59
5.6.360.0080.00014.25
5.6.350.0000.00814.28
5.6.340.0040.00714.11
5.6.330.0030.01414.55
5.6.320.0000.01014.46
5.6.310.0140.00013.96
5.6.300.0040.00814.43
5.6.290.0120.00613.92
5.6.280.0070.03817.44
5.6.270.0060.00614.25
5.6.260.0000.01214.07
5.6.250.0050.02717.47
5.6.240.0050.02317.31
5.6.230.0050.02517.48
5.6.220.0060.02317.35
5.6.210.0070.02017.36
5.6.200.0080.04317.53
5.6.190.0070.04417.61
5.6.180.0050.03617.60
5.6.170.0110.04317.69
5.6.160.0100.04217.65
5.6.150.0060.04517.70
5.6.140.0030.04717.73
5.6.130.0080.03817.79
5.6.120.0040.04217.55
5.6.110.0030.05017.53
5.6.100.0080.04217.59
5.6.90.0100.03217.56
5.6.80.0120.02317.30
5.6.70.0070.04417.26
5.6.60.0070.04317.26
5.6.50.0090.02717.27
5.6.40.0080.03217.39
5.6.30.0060.03017.32
5.6.20.0080.04117.13
5.6.10.0120.02617.36
5.6.00.0080.04017.40
5.5.380.0080.01815.78
5.5.370.0030.02415.78
5.5.360.0020.02315.76
5.5.350.0050.02315.66
5.5.340.0090.03315.68
5.5.330.0040.02715.87
5.5.320.0070.04415.96
5.5.310.0070.04315.93
5.5.300.0110.04116.04
5.5.290.0030.03115.90
5.5.280.0070.02815.91
5.5.270.0140.04215.91
5.5.260.0050.02115.99
5.5.250.0050.04515.69
5.5.240.0050.04015.65
5.5.230.0020.03615.74
5.5.220.0070.03215.59
5.5.210.0070.03515.68
5.5.200.0050.03615.69
5.5.190.0100.03715.68
5.5.180.0080.02215.39
5.5.170.0070.00411.10
5.5.160.0030.04415.68
5.5.150.0100.02315.57
5.5.140.0060.04515.51
5.5.130.0050.02815.63
5.5.120.0100.02415.77
5.5.110.0050.03115.44
5.5.100.0040.04315.35
5.5.90.0110.03715.44
5.5.80.0090.03415.56
5.5.70.0120.03515.36
5.5.60.0070.02315.67
5.5.50.0150.03215.63
5.5.40.0070.03815.67
5.5.30.0040.04415.70
5.5.20.0060.02515.63
5.5.10.0110.03815.47
5.5.00.0150.03815.60
5.4.450.0020.04015.23
5.4.440.0020.04015.01
5.4.430.0070.04015.27
5.4.420.0070.04214.94
5.4.410.0080.03814.96
5.4.400.0080.03915.07
5.4.390.0050.04315.05
5.4.380.0080.04014.98
5.4.370.0080.03814.93
5.4.360.0070.04114.98
5.4.350.0080.03715.03
5.4.340.0100.03714.88
5.4.330.0040.00411.17
5.4.320.0080.03814.99
5.4.310.0030.03114.95
5.4.300.0070.03714.85
5.4.290.0070.03615.11
5.4.280.0050.04215.05
5.4.270.0060.03715.06
5.4.260.0060.04114.91
5.4.250.0050.02314.87
5.4.240.0120.03415.11
5.4.230.0100.03114.97
5.4.220.0050.03515.05
5.4.210.0080.03814.97
5.4.200.0090.03715.00
5.4.190.0040.03214.96
5.4.180.0030.02314.86
5.4.170.0050.02614.78
5.4.160.0110.03314.84
5.4.150.0070.04215.04
5.4.140.0030.04113.63
5.4.130.0100.04013.76
5.4.120.0090.02013.52
5.4.110.0050.02813.71
5.4.100.0050.03513.65
5.4.90.0100.03413.76
5.4.80.0120.03513.75
5.4.70.0050.03613.72
5.4.60.0120.02713.60
5.4.50.0080.02013.60
5.4.40.0080.03713.58
5.4.30.0070.03613.83
5.4.20.0020.03413.69
5.4.10.0070.02513.82
5.4.00.0110.03313.48
5.3.290.0060.03812.58
5.3.280.0100.03612.59
5.3.270.0050.03712.64
5.3.260.0020.02612.68
5.3.250.0050.02312.63
5.3.240.0050.03812.55
5.3.230.0030.04112.53
5.3.220.0020.04312.53
5.3.210.0020.02612.61
5.3.200.0040.02112.52
5.3.190.0020.04812.64
5.3.180.0090.03012.72
5.3.170.0050.04112.57
5.3.160.0040.02612.63
5.3.150.0050.03812.60
5.3.140.0050.04412.48
5.3.130.0090.03612.50
5.3.120.0080.02912.58
5.3.110.0030.04212.64
5.3.100.0110.02812.32
5.3.90.0070.03912.35
5.3.80.0050.03812.11
5.3.70.0070.03712.15
5.3.60.0070.03712.20
5.3.50.0030.03912.17
5.3.40.0090.02712.23
5.3.30.0070.03812.26
5.3.20.0030.04012.10
5.3.10.0010.03812.00
5.3.00.0050.04011.95
5.2.170.0060.01811.06
5.2.160.0030.02311.06
5.2.150.0050.01811.06
5.2.140.0040.03411.06
5.2.130.0030.03211.06
5.2.120.0100.01211.06
5.2.110.0080.02711.06
5.2.100.0020.02111.06
5.2.90.0040.03311.06
5.2.80.0110.01511.06
5.2.70.0000.02011.06
5.2.60.0020.02711.06
5.2.50.0030.02211.06
5.2.40.0070.01511.06
5.2.30.0090.02811.06
5.2.20.0060.02611.06
5.2.10.0000.03711.06
5.2.00.0070.01611.06
5.1.60.0090.02511.06
5.1.50.0130.01511.06
5.1.40.0030.01311.06
5.1.30.0020.01811.06
5.1.20.0030.02511.06
5.1.10.0030.02411.06
5.1.00.0000.01911.06
5.0.50.0030.02411.06
5.0.40.0080.01011.06
5.0.30.0020.02011.06
5.0.20.0000.02211.06
5.0.10.0060.01511.06
5.0.00.0000.01911.06
4.4.90.0020.02011.06
4.4.80.0050.02011.06
4.4.70.0020.01811.06
4.4.60.0020.01811.06
4.4.50.0010.02111.06
4.4.40.0020.02111.06
4.4.30.0040.01211.06
4.4.20.0010.01911.06
4.4.10.0050.01711.06
4.4.00.0010.03111.06
4.3.110.0020.02011.06
4.3.100.0000.01311.06
4.3.90.0000.01011.06
4.3.80.0030.01711.06
4.3.70.0010.01811.06
4.3.60.0050.01611.06
4.3.50.0020.02011.06
4.3.40.0020.02811.06
4.3.30.0000.01611.06
4.3.20.0000.01811.06
4.3.10.0050.00811.06
4.3.00.0020.01511.06

preferences:
40.62 ms | 400 KiB | 5 Q