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 get() { } public function the() { } public function 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.0110.01116.88
8.3.50.0070.01222.10
8.3.40.0080.00818.90
8.3.30.0140.00719.13
8.3.20.0060.00320.38
8.3.10.0040.00423.70
8.3.00.0060.00319.25
8.2.180.0120.00618.66
8.2.170.0170.00322.96
8.2.160.0110.00420.28
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0070.00726.16
8.2.120.0040.00422.11
8.2.110.0040.00422.14
8.2.100.0040.00818.03
8.2.90.0000.00819.22
8.2.80.0040.00417.97
8.2.70.0080.00017.48
8.2.60.0040.00817.92
8.2.50.0110.00018.07
8.2.40.0090.00019.82
8.2.30.0050.00217.94
8.2.20.0070.00017.68
8.2.10.0040.00419.85
8.2.00.0040.00417.56
8.1.280.0130.00725.92
8.1.270.0080.00023.88
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0030.00624.04
8.1.230.0080.00419.07
8.1.220.0080.00017.74
8.1.210.0000.00818.77
8.1.200.0030.00717.35
8.1.190.0050.00317.63
8.1.180.0040.00418.10
8.1.170.0030.00718.57
8.1.160.0040.00421.97
8.1.150.0000.00818.61
8.1.140.0050.00217.46
8.1.130.0070.00017.84
8.1.120.0040.00417.38
8.1.110.0000.00817.34
8.1.100.0050.00317.44
8.1.90.0040.00417.44
8.1.80.0030.00317.52
8.1.70.0000.00717.43
8.1.60.0040.00417.48
8.1.50.0090.00017.46
8.1.40.0000.00817.55
8.1.30.0060.00317.61
8.1.20.0000.00817.71
8.1.10.0000.00817.45
8.1.00.0040.00417.40
8.0.300.0050.00319.21
8.0.290.0040.00417.18
8.0.280.0070.00018.45
8.0.270.0000.00717.26
8.0.260.0000.00717.27
8.0.250.0000.00817.09
8.0.240.0030.00517.00
8.0.230.0000.00816.90
8.0.220.0000.00716.96
8.0.210.0060.00316.89
8.0.200.0000.00716.91
8.0.190.0000.00716.91
8.0.180.0030.00716.99
8.0.170.0080.00016.91
8.0.160.0000.00816.98
8.0.150.0040.00416.89
8.0.140.0050.00316.90
8.0.130.0060.00013.36
8.0.120.0060.00316.80
8.0.110.0040.00416.80
8.0.100.0000.00716.98
8.0.90.0030.00416.96
8.0.80.0090.00616.91
8.0.70.0040.00416.84
8.0.60.0080.00016.79
8.0.50.0050.00216.98
8.0.30.0110.00717.14
8.0.20.0130.00417.40
8.0.10.0030.00517.03
8.0.00.0130.00716.69
7.4.330.0000.00615.00
7.4.320.0000.00616.61
7.4.300.0030.00316.36
7.4.290.0030.00316.61
7.4.280.0030.00316.64
7.4.270.0000.00716.44
7.4.260.0030.00316.54
7.4.250.0030.00516.48
7.4.240.0000.00716.52
7.4.230.0000.00716.59
7.4.220.0070.01416.62
7.4.210.0060.00916.61
7.4.200.0030.00316.35
7.4.190.0070.00016.40
7.4.160.0100.01016.71
7.4.150.0140.00417.40
7.4.140.0100.00717.86
7.4.130.0120.01016.54
7.4.120.0110.00716.46
7.4.110.0060.01216.73
7.4.100.0120.01216.42
7.4.90.0140.00316.55
7.4.80.0070.01519.39
7.4.70.0030.01716.43
7.4.60.0120.00616.54
7.4.50.0000.00516.80
7.4.40.0090.00922.77
7.4.30.0030.01416.42
7.4.10.0100.01014.79
7.4.00.0030.01014.97
7.3.330.0040.00413.30
7.3.320.0000.00513.21
7.3.310.0050.00216.39
7.3.300.0030.00616.36
7.3.290.0060.01016.34
7.3.280.0090.00616.33
7.3.270.0160.00617.40
7.3.260.0070.01116.34
7.3.250.0060.01116.30
7.3.240.0060.01016.36
7.3.230.0110.00716.39
7.3.210.0080.00816.26
7.3.200.0130.00919.39
7.3.190.0100.01016.39
7.3.180.0090.01116.39
7.3.170.0090.00616.37
7.3.160.0100.00716.43
7.3.130.0030.01614.88
7.3.120.0050.00914.86
7.3.110.0070.01014.86
7.3.100.0040.01114.95
7.3.90.0110.00014.73
7.3.80.0070.00714.85
7.3.70.0090.00314.82
7.3.60.0130.00714.97
7.3.50.0030.00915.06
7.3.40.0000.00914.90
7.3.30.0170.00014.71
7.3.20.0110.00416.61
7.3.10.0080.00516.73
7.3.00.0100.00216.62
7.2.330.0100.00716.27
7.2.320.0170.00016.70
7.2.310.0110.00616.62
7.2.300.0140.02116.77
7.2.290.0120.00416.72
7.2.260.0090.00915.10
7.2.250.0070.01314.89
7.2.240.0030.01015.21
7.2.230.0040.01114.93
7.2.220.0000.01314.59
7.2.210.0100.00314.66
7.2.200.0030.01215.19
7.2.190.0100.00315.05
7.2.180.0000.01314.83
7.2.170.0070.00714.97
7.2.160.0060.00915.06
7.2.150.0040.00816.71
7.2.140.0000.00916.93
7.2.130.0070.00616.93
7.2.120.0020.01416.86
7.2.110.0090.00316.74
7.2.100.0030.00816.72
7.2.90.0100.00616.86
7.2.80.0050.01016.86
7.2.70.0030.01116.97
7.2.60.0060.00716.98
7.2.50.0060.00916.90
7.2.40.0050.00916.93
7.2.30.0090.00616.76
7.2.20.0040.01116.95
7.2.10.0070.00316.89
7.2.00.0040.01017.64
7.1.330.0070.01015.58
7.1.320.0120.00315.89
7.1.310.0060.00815.73
7.1.300.0100.01015.60
7.1.290.0030.01015.75
7.1.280.0000.01515.78
7.1.270.0100.00615.73
7.1.260.0110.00415.77
7.1.250.0020.00715.82
7.1.240.0070.00715.75
7.1.230.0080.00315.61
7.1.220.0090.00615.85
7.1.210.0030.01015.75
7.1.200.0020.00715.56
7.1.190.0040.00415.56
7.1.180.0040.00415.81
7.1.170.0000.01115.71
7.1.160.0030.01015.61
7.1.150.0030.01015.83
7.1.140.0000.01315.70
7.1.130.0060.00315.84
7.1.120.0040.01115.53
7.1.110.0090.00615.66
7.1.100.0060.00617.06
7.1.90.0030.01015.76
7.1.80.0040.01115.61
7.1.70.0040.00416.33
7.1.60.0070.01217.66
7.1.50.0080.01116.32
7.1.40.0060.00315.85
7.1.30.0080.00415.64
7.1.20.0080.00815.84
7.1.10.0040.00715.79
7.1.00.0000.04718.91
7.0.330.0080.00415.48
7.0.320.0070.01015.45
7.0.310.0040.01215.06
7.0.300.0000.01115.22
7.0.290.0070.00715.47
7.0.280.0000.01215.21
7.0.270.0030.01015.32
7.0.260.0070.00715.14
7.0.250.0000.00815.13
7.0.240.0080.00415.61
7.0.230.0000.01215.57
7.0.220.0090.00315.19
7.0.210.0030.01015.39
7.0.200.0040.00616.13
7.0.190.0000.00815.37
7.0.180.0070.00315.51
7.0.170.0090.00615.62
7.0.160.0070.00715.25
7.0.150.0000.01115.27
7.0.140.0050.03818.62
7.0.130.0080.00415.35
7.0.120.0080.00315.55
7.0.110.0000.01015.38
7.0.100.0030.01015.45
7.0.90.0000.00815.34
7.0.80.0070.00715.11
7.0.70.0060.00615.25
7.0.60.0060.03017.62
7.0.50.0100.01816.54
7.0.40.0050.03516.86
7.0.30.0340.03816.90
7.0.20.0120.02616.75
7.0.10.0060.03316.80
7.0.00.0050.04016.90
5.6.400.0000.01014.05
5.6.390.0040.00814.30
5.6.380.0110.00314.15
5.6.370.0030.00614.12
5.6.360.0000.00814.48
5.6.350.0030.00914.34
5.6.340.0080.00814.34
5.6.330.0070.00714.32
5.6.320.0000.01014.59
5.6.310.0030.01014.28
5.6.300.0040.00814.43
5.6.290.0060.00614.29
5.6.280.0040.04217.70
5.6.270.0070.01014.24
5.6.260.0130.00314.46
5.6.250.0040.00414.28
5.6.240.0030.00914.12
5.6.230.0090.00614.14
5.6.220.0100.00314.45
5.6.210.0070.04317.51
5.6.200.0100.04516.27
5.6.190.0080.04717.49
5.6.180.0120.04417.63
5.6.170.0170.04217.32
5.6.160.0080.03017.52
5.6.150.0030.02516.33
5.6.140.0080.03716.21
5.6.130.0110.03116.23
5.6.120.0070.02217.56
5.6.110.0050.04717.80
5.6.100.0030.02917.70
5.6.90.0050.04417.70
5.6.80.0030.04117.36
5.6.70.2320.02217.18
5.6.60.0100.00714.40
5.6.50.0060.00914.34
5.6.40.0060.00914.23
5.6.30.0070.01114.25
5.6.20.0120.00314.13
5.6.10.0070.00714.14
5.6.00.0030.01314.24
5.5.380.0040.01114.31
5.5.370.0040.00414.30
5.5.360.0090.00014.27
5.5.350.0180.03817.34
5.5.340.0050.03716.18
5.5.330.0030.04017.43
5.5.320.0130.02717.38
5.5.310.0260.03517.47
5.5.300.0050.02316.35
5.5.290.0050.03516.02
5.5.280.0100.02717.40
5.5.270.0050.02717.58
5.5.260.0070.03917.62
5.5.250.0070.04417.38
5.5.240.0160.02917.35
5.5.230.0070.00714.20
5.5.220.0060.01013.82
5.5.210.0040.01114.35
5.5.200.0000.01214.29
5.5.190.0110.00713.89
5.5.180.0100.00714.14
5.5.170.0030.01314.08
5.5.160.0070.00714.40
5.5.150.0060.00914.13
5.5.140.0100.00714.12
5.5.130.0060.00313.88
5.5.120.0100.00714.21
5.5.110.0070.01014.07
5.5.100.0070.00714.14
5.5.90.0090.00013.97
5.5.80.0140.00014.29
5.5.70.0030.00914.21
5.5.60.0070.00314.30
5.5.50.0030.00814.27
5.5.40.0000.00914.37
5.5.30.0040.00814.16
5.5.20.0050.00514.50
5.5.10.0070.00714.10
5.5.00.0000.01314.30
5.4.450.0460.03015.76
5.4.440.0480.04815.58
5.4.430.0080.03015.73
5.4.420.0370.03715.77
5.4.410.0430.03315.58
5.4.400.0090.03015.60
5.4.390.0470.02715.57
5.4.380.0170.03015.39
5.4.370.0160.03115.36
5.4.360.0140.03215.24
5.4.350.0180.02815.37
5.4.340.0270.04115.30
5.4.330.0070.00712.00
5.4.320.0030.02612.25
5.4.310.0050.02312.25
5.4.300.0090.01812.25
5.4.290.0040.02812.24
5.4.280.0050.02512.19
5.4.270.0050.02812.19
5.4.260.0060.02612.19
5.4.250.0070.02312.19
5.4.240.0070.02712.19
5.4.230.0050.02912.19
5.4.220.0070.02312.19
5.4.210.0050.02012.19
5.4.200.0070.02112.19
5.4.190.0060.02312.18
5.4.180.0020.02912.19
5.4.170.0030.03312.19
5.4.160.0080.02612.19
5.4.150.0030.02612.19
5.4.140.0070.02312.03
5.4.130.0050.02012.03
5.4.120.0060.02212.00
5.4.110.0060.02212.00
5.4.100.0020.02412.00
5.4.90.0040.02312.00
5.4.80.0060.02312.00
5.4.70.0040.02412.00
5.4.60.0050.02212.00
5.4.50.0050.02012.00
5.4.40.0070.01911.99
5.4.30.0040.02111.99
5.4.20.0070.02011.99
5.4.10.0040.02411.99
5.4.00.0030.02911.74
5.3.290.0050.02412.40
5.3.280.0050.02212.35
5.3.270.0070.01912.36
5.3.260.0040.02312.36
5.3.250.0070.02212.36
5.3.240.0030.02312.36
5.3.230.0030.02212.35
5.3.220.0050.02412.34
5.3.210.0070.02212.34
5.3.200.0070.02012.34
5.3.190.0040.02412.34
5.3.180.0060.02212.33
5.3.170.0070.02212.33
5.3.160.0040.02312.33
5.3.150.0040.02412.33
5.3.140.0060.02012.33
5.3.130.0050.02312.33
5.3.120.0020.02312.33
5.3.110.0080.02212.32
5.3.100.0050.02512.06
5.3.90.0070.02612.05
5.3.80.0080.02812.05
5.3.70.0050.02312.05
5.3.60.0020.02412.04
5.3.50.0050.02112.02
5.3.40.0060.02412.01
5.3.30.0070.02211.99
5.3.20.0060.02011.89
5.3.10.0080.01911.87
5.3.00.0050.02011.86
5.2.170.0050.0309.23
5.2.160.0050.0299.23
5.2.150.0050.0319.23
5.2.140.0080.0309.22
5.2.130.0080.0299.19
5.2.120.0070.0339.19
5.2.110.0070.0289.20
5.2.100.0020.0329.19
5.2.90.0090.0309.19
5.2.80.0030.0389.19
5.2.70.0060.0429.19
5.2.60.0100.0279.13
5.2.50.0070.0299.10
5.2.40.0060.0329.08
5.2.30.0050.0359.06
5.2.20.0090.0329.05
5.2.10.0080.0318.96
5.2.00.0040.0318.82
5.1.60.0040.0258.10
5.1.50.0050.0288.10
5.1.40.0060.0268.08
5.1.30.0040.0388.43
5.1.20.0060.0358.45
5.1.10.0050.0348.17
5.1.00.0060.0428.18
5.0.50.0020.0316.66
5.0.40.0060.0276.52
5.0.30.0070.0336.33
5.0.20.0060.0266.30
5.0.10.0030.0296.28
5.0.00.0060.0306.27
4.4.90.0050.0234.78
4.4.80.0040.0224.76
4.4.70.0010.0244.75
4.4.60.0070.0214.76
4.4.50.0030.0224.77
4.4.40.0020.0344.71
4.4.30.0090.0154.76
4.4.20.0080.0194.84
4.4.10.0050.0244.84
4.4.00.0070.0554.76
4.3.110.0080.0134.67
4.3.100.0030.0164.66
4.3.90.0030.0184.63
4.3.80.0040.0244.58
4.3.70.0030.0144.63
4.3.60.0060.0144.63
4.3.50.0070.0164.63
4.3.40.0050.0294.54
4.3.30.0020.0183.30
4.3.20.0030.0173.28
4.3.10.0020.0243.23
4.3.00.0100.01710.54

preferences:
45.75 ms | 401 KiB | 5 Q