3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Challenge 3: Use reflection to get access to Question::$answer from $e->getAnswer */ class Question { private $answer = 42; public function __construct($e) { try { throw $e; } catch (Exception $e) { echo $e->getAnswer($this) . PHP_EOL; } } } // start editing here class exceptionFun extends Exception { public function staty() { return Question::$answer; } public function getAnswer($that) { //$getTheAnswer = Closure::bind($this->getPrivate(),$that); $getTheAnswer = Closure::bind($this->staty(), null, $that); $result = $getTheAnswer($that); return $result; } public function getPrivate($that) { return $that->answer; } } $e = new exceptionFun(); // end editing here new Question($e);

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.0120.00318.68
8.3.50.0110.00821.97
8.3.40.0110.00718.71
8.3.30.0070.01019.03
8.3.20.0040.00420.34
8.3.10.0000.00823.67
8.3.00.0050.00319.38
8.2.180.0120.00618.13
8.2.170.0060.01022.96
8.2.160.0070.00720.29
8.2.150.0040.00424.18
8.2.140.0000.00724.66
8.2.130.0000.00826.16
8.2.120.0050.00222.08
8.2.110.0090.00022.25
8.2.100.0070.00417.91
8.2.90.0040.00419.17
8.2.80.0030.00518.04
8.2.70.0000.00917.63
8.2.60.0030.00617.80
8.2.50.0000.00818.07
8.2.40.0050.00319.86
8.2.30.0000.00818.03
8.2.20.0040.00417.69
8.2.10.0080.00018.15
8.2.00.0030.00617.75
8.1.280.0200.00025.92
8.1.270.0000.00823.67
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0060.00323.91
8.1.230.0090.00319.00
8.1.220.0080.00017.74
8.1.210.0000.01018.77
8.1.200.0030.00617.35
8.1.190.0040.00417.64
8.1.180.0080.00418.10
8.1.170.0030.00918.59
8.1.160.0040.00421.95
8.1.150.0100.00318.68
8.1.140.0040.00417.39
8.1.130.0030.00317.79
8.1.120.0000.00717.46
8.1.110.0000.00717.56
8.1.100.0030.00717.39
8.1.90.0030.00517.48
8.1.80.0000.00717.39
8.1.70.0030.00317.43
8.1.60.0050.00517.64
8.1.50.0040.00417.55
8.1.40.0000.00817.45
8.1.30.0060.00317.61
8.1.20.0000.00817.74
8.1.10.0050.00317.58
8.1.00.0030.00617.45
8.0.300.0080.00018.90
8.0.290.0000.00817.18
8.0.280.0000.00718.35
8.0.270.0040.00416.77
8.0.260.0030.00317.26
8.0.250.0050.00317.02
8.0.240.0030.00516.88
8.0.230.0000.00716.84
8.0.220.0030.00316.93
8.0.210.0070.00016.85
8.0.200.0000.00616.97
8.0.190.0000.00817.01
8.0.180.0030.00616.93
8.0.170.0030.00616.96
8.0.160.0030.00316.78
8.0.150.0000.00816.75
8.0.140.0000.00716.86
8.0.130.0030.00313.40
8.0.120.0000.00816.95
8.0.110.0000.00916.88
8.0.100.0020.00516.80
8.0.90.0000.00716.82
8.0.80.0070.00716.95
8.0.70.0040.00416.98
8.0.60.0040.00416.80
8.0.50.0070.00016.91
8.0.30.0050.01417.02
8.0.20.0090.01117.40
8.0.10.0040.00416.91
8.0.00.0090.00916.61
7.4.330.0050.00015.00
7.4.320.0000.00716.61
7.4.300.0040.00416.48
7.4.290.0040.00416.57
7.4.280.0000.00716.64
7.4.270.0050.00316.60
7.4.260.0040.00416.50
7.4.250.0000.00816.60
7.4.240.0020.00516.67
7.4.230.0000.00716.61
7.4.220.0140.00316.57
7.4.210.0070.00716.53
7.4.200.0030.00316.37
7.4.190.0030.00316.72
7.4.160.0130.00316.42
7.4.150.0090.00917.40
7.4.140.0150.00517.86
7.4.130.0110.00516.50
7.4.120.0060.01116.61
7.4.110.0030.01316.43
7.4.100.0150.00316.59
7.4.90.0030.01616.75
7.4.80.0100.01119.39
7.4.70.0030.01316.49
7.4.60.0030.01416.51
7.4.50.0000.00916.49
7.4.40.0000.01522.77
7.4.30.0060.00916.64
7.4.00.0090.00615.24
7.3.330.0030.00313.20
7.3.320.0030.00313.38
7.3.310.0000.00716.30
7.3.300.0000.00916.23
7.3.290.0060.00916.38
7.3.280.0070.01216.40
7.3.270.0090.00917.40
7.3.260.0110.00716.52
7.3.250.0120.00916.49
7.3.240.0070.01016.40
7.3.230.0130.00316.54
7.3.210.0070.01016.57
7.3.200.0100.01519.39
7.3.190.0140.00316.58
7.3.180.0000.01516.32
7.3.170.0050.01116.50
7.3.160.0100.00616.59
7.3.120.0060.00914.95
7.3.10.0050.01116.53
7.3.00.0050.01016.41
7.2.330.0100.00716.83
7.2.320.0070.01116.61
7.2.310.0100.00716.74
7.2.300.0090.01216.75
7.2.290.0090.00916.57
7.2.130.0030.01016.76
7.2.120.0090.00416.76
7.2.110.0110.00516.85
7.2.100.0090.00516.77
7.2.90.0060.00916.87
7.2.80.0070.01016.93
7.2.70.0090.00516.96
7.2.60.0080.00616.82
7.2.50.0090.00516.74
7.2.40.0070.00516.98
7.2.30.0100.00716.91
7.2.20.0060.00416.86
7.2.10.0070.00516.73
7.2.00.0080.00617.68
7.1.250.0050.00815.50
7.1.200.0110.00015.84
7.1.100.0040.01117.95
7.1.70.0040.00416.98
7.1.60.0080.00419.46
7.1.50.0060.01516.85
7.1.00.0070.07322.43
7.0.200.0030.00616.85
7.0.140.0070.07022.09
7.0.110.0170.05319.96
7.0.100.0230.04719.96
7.0.90.0170.07720.02
7.0.80.0030.08019.84
7.0.70.0130.08020.03
7.0.60.0170.04020.02
7.0.50.0130.07720.37
7.0.40.0070.08720.24
7.0.30.0070.06320.03
7.0.20.0170.07020.05
7.0.10.0100.08720.18
7.0.00.0100.08020.18
5.6.260.0000.08020.73
5.6.250.0070.07720.68
5.6.240.0000.09020.58
5.6.230.0030.05320.64
5.6.220.0070.08020.85
5.6.210.0130.07320.59
5.6.200.0130.07320.98
5.6.190.0030.05021.28
5.6.180.0100.07020.99
5.6.170.0130.07721.22
5.6.160.0100.08021.07
5.6.150.0170.07321.16
5.6.140.0000.05721.06
5.6.130.0170.08020.95
5.6.120.0130.07720.99
5.6.110.0070.07321.03
5.6.100.0170.07321.13
5.6.90.0070.08021.13
5.6.80.0070.07020.34
5.6.70.0070.07020.53
5.6.60.0100.06020.34
5.6.50.0070.06320.54
5.6.40.0200.06720.42
5.6.30.0030.08320.32
5.6.20.0170.06720.50
5.6.10.0130.07020.31
5.6.00.0170.06020.33
5.5.380.0130.08320.36
5.5.370.0230.06720.55
5.5.360.0070.08020.46
5.5.350.0200.07020.49
5.5.340.0030.08720.82
5.5.330.0100.08320.93
5.5.320.0230.06721.04
5.5.310.0100.08020.91
5.5.300.0130.06320.90
5.5.290.0100.08020.75
5.5.280.0100.08021.00
5.5.270.0200.07320.84
5.5.260.0030.08020.82
5.5.250.0130.07320.73
5.5.240.0030.04020.28
5.5.230.0070.08720.38
5.5.220.0070.04720.29
5.5.210.0030.08020.29
5.5.200.0000.08320.18
5.5.190.0070.07020.26
5.5.180.0100.08020.27
5.5.160.0070.08320.11
5.5.150.0200.06720.38
5.5.140.0200.06020.29
5.5.130.0130.07320.25
5.5.120.0130.04020.30
5.5.110.0170.06020.24
5.5.100.0100.06720.27
5.5.90.0100.07020.06
5.5.80.0130.07020.26
5.5.70.0030.06720.05
5.5.60.0030.08020.21
5.5.50.0030.07720.11
5.5.40.0100.06720.14
5.5.30.0100.07319.98
5.5.20.0030.08720.04
5.5.10.0130.07320.04
5.5.00.0000.08320.02
5.4.450.0070.06719.50
5.4.440.0130.05019.51
5.4.430.0030.05019.50
5.4.420.0070.04719.57
5.4.410.0070.05019.15
5.4.400.0130.06719.28
5.4.390.0100.07019.00
5.4.380.0030.08318.96
5.4.370.0070.07319.00
5.4.360.0100.07018.95
5.4.350.0030.08019.16
5.4.340.0030.05319.09
5.4.320.0070.06319.24
5.4.310.0070.08019.01
5.4.300.0100.07019.13
5.4.290.0070.08019.24
5.4.280.0030.07018.99
5.4.270.0130.07019.00
5.4.260.0130.06719.00
5.4.250.0130.06719.00
5.4.240.0130.07018.99
5.4.230.0170.06719.33
5.4.220.0070.07019.01
5.4.210.0130.07019.15
5.4.200.0000.07719.00
5.4.190.0130.06318.97
5.4.180.0100.07319.18
5.4.170.0030.07719.15
5.4.160.0100.04319.03
5.4.150.0100.07318.96
5.4.140.0070.04316.41
5.4.130.0100.07016.48
5.4.120.0070.07016.44
5.4.110.0070.07016.56
5.4.100.0070.07716.37
5.4.90.0030.05016.36
5.4.80.0130.06716.51
5.4.70.0100.03316.40
5.4.60.0000.08016.39
5.4.50.0070.07316.54
5.4.40.0100.07316.53
5.4.30.0030.07316.41
5.4.20.0100.06716.53
5.4.10.0070.06016.62
5.4.00.0100.06015.95
5.3.290.0070.06014.77
5.3.280.0070.07714.61
5.3.270.0100.07014.64
5.3.260.0130.07014.70
5.3.250.0100.07014.62
5.3.240.0130.05714.57
5.3.230.0070.08014.83
5.3.220.0030.06714.61
5.3.210.0200.06714.59
5.3.200.0070.07314.59
5.3.190.0100.06014.44
5.3.180.0100.05014.70
5.3.170.0170.06314.43
5.3.160.0030.07714.61
5.3.150.0130.07314.70
5.3.140.0100.06314.70
5.3.130.0100.07714.69
5.3.120.0000.08314.55
5.3.110.0070.07714.69
5.3.100.0100.07314.05
5.3.90.0100.07014.18
5.3.80.0170.06314.15
5.3.70.0030.06714.03
5.3.60.0070.07013.98
5.3.50.0100.03714.10
5.3.40.0000.07714.10
5.3.30.0030.07713.94
5.3.20.0100.07313.77
5.3.10.0070.06313.79
5.3.00.0070.06713.72
5.2.170.0000.06712.01
5.2.160.0100.05712.01
5.2.150.0100.05712.01
5.2.140.0000.04012.01
5.2.130.0170.05012.01
5.2.120.0070.05712.01
5.2.110.0170.05312.01
5.2.100.0000.07012.01
5.2.90.0030.03712.01
5.2.80.0070.05712.01
5.2.70.0070.05712.01
5.2.60.0100.05712.01
5.2.50.0070.06012.01
5.2.40.0070.05712.01
5.2.30.0130.03012.01
5.2.20.0100.06312.01
5.2.10.0030.06012.01
5.2.00.0130.04712.01
5.1.60.0030.05712.01
5.1.50.0070.05312.01
5.1.40.0070.02712.01
5.1.30.0030.06012.01
5.1.20.0030.05712.01
5.1.10.0100.04712.01
5.1.00.0000.05712.01
5.0.50.0070.04012.01
5.0.40.0030.04312.01
5.0.30.0000.06312.01
5.0.20.0070.03312.01
5.0.10.0000.03012.01
5.0.00.0030.06312.01
4.4.90.0030.03712.01
4.4.80.0030.03012.01
4.4.70.0000.02712.01
4.4.60.0030.03012.01
4.4.50.0030.03312.01
4.4.40.0000.05312.01
4.4.30.0100.03012.01
4.4.20.0030.03712.01
4.4.10.0030.03712.01
4.4.00.0030.05012.01
4.3.110.0030.02012.01
4.3.100.0070.03012.01
4.3.90.0030.02312.01
4.3.80.0030.04312.01
4.3.70.0070.02712.01
4.3.60.0030.03312.01
4.3.50.0030.02712.01
4.3.40.0000.05312.01
4.3.30.0030.03312.01
4.3.20.0000.04012.01
4.3.10.0030.03312.01
4.3.00.0000.03012.01

preferences:
48.16 ms | 400 KiB | 5 Q