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 getAnswer($that) { $cl1 = static function() { return Question::$answer; }; //$getTheAnswer = Closure::bind($this->getPrivate(),$that); $getTheAnswer = Closure::bind($cl1, 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.0090.00618.43
8.3.50.0100.01022.05
8.3.40.0070.01118.79
8.3.30.0140.00719.04
8.3.20.0080.00020.39
8.3.10.0040.00423.62
8.3.00.0040.00419.13
8.2.180.0130.00916.73
8.2.170.0040.01122.96
8.2.160.0100.01020.32
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0050.00326.16
8.2.120.0080.00022.13
8.2.110.0030.00722.20
8.2.100.0120.00017.84
8.2.90.0040.00419.18
8.2.80.0040.00717.97
8.2.70.0060.00317.63
8.2.60.0050.00517.92
8.2.50.0000.01018.07
8.2.40.0040.00419.97
8.2.30.0000.00818.13
8.2.20.0000.00717.77
8.2.10.0040.00418.10
8.2.00.0080.00017.76
8.1.280.0070.00725.92
8.1.270.0060.00323.85
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0050.00323.91
8.1.230.0090.00319.16
8.1.220.0060.00317.74
8.1.210.0000.00818.77
8.1.200.0030.00617.47
8.1.190.0050.00317.40
8.1.180.0030.00618.10
8.1.170.0000.00818.66
8.1.160.0040.00422.09
8.1.150.0000.01018.57
8.1.140.0000.00817.45
8.1.130.0070.00017.72
8.1.120.0040.00317.52
8.1.110.0090.00017.37
8.1.100.0070.00317.37
8.1.90.0000.00817.47
8.1.80.0040.00417.54
8.1.70.0070.00017.34
8.1.60.0030.00617.59
8.1.50.0040.00417.52
8.1.40.0050.00317.50
8.1.30.0000.00817.55
8.1.20.0000.00817.65
8.1.10.0070.00017.51
8.1.00.0050.00217.51
8.0.300.0040.00419.15
8.0.290.0080.00017.16
8.0.280.0080.00018.39
8.0.270.0030.00317.13
8.0.260.0000.00717.27
8.0.250.0000.00717.02
8.0.240.0030.00516.94
8.0.230.0070.00016.93
8.0.220.0030.00316.94
8.0.210.0000.00716.93
8.0.200.0030.00316.98
8.0.190.0040.00417.01
8.0.180.0090.00017.04
8.0.170.0030.00617.00
8.0.160.0000.00716.83
8.0.150.0040.00416.86
8.0.140.0000.00716.96
8.0.130.0060.00013.45
8.0.120.0000.00816.96
8.0.110.0060.00316.89
8.0.100.0070.00016.87
8.0.90.0000.00716.92
8.0.80.0070.00716.89
8.0.70.0000.00716.78
8.0.60.0000.01016.85
8.0.50.0000.00716.83
8.0.30.0120.00717.12
8.0.20.0100.00817.40
8.0.10.0070.00017.00
8.0.00.0100.00816.90
7.4.330.0050.00015.00
7.4.320.0000.00616.62
7.4.300.0050.00216.60
7.4.290.0000.00716.60
7.4.280.0050.00316.42
7.4.270.0070.00016.52
7.4.260.0030.00516.59
7.4.250.0000.00716.48
7.4.240.0070.00016.55
7.4.230.0030.00316.46
7.4.220.0100.00716.57
7.4.210.0090.00716.67
7.4.200.0030.00316.65
7.4.190.0000.00716.76
7.4.160.0100.00716.69
7.4.150.0100.00717.40
7.4.140.0130.00517.86
7.4.130.0120.00516.42
7.4.120.0140.00516.55
7.4.110.0100.00716.62
7.4.100.0070.01316.50
7.4.90.0100.01116.59
7.4.80.0170.00719.39
7.4.70.0100.00716.54
7.4.60.0100.00616.69
7.4.50.0060.00316.69
7.4.40.0070.00722.77
7.4.30.0070.01016.55
7.4.00.0080.00615.04
7.3.330.0030.00313.34
7.3.320.0000.00613.30
7.3.310.0000.00716.25
7.3.300.0000.00816.23
7.3.290.0120.00916.35
7.3.280.0090.00916.40
7.3.270.0040.01217.40
7.3.260.0100.00716.55
7.3.250.0150.00616.42
7.3.240.0100.00716.46
7.3.230.0110.00516.56
7.3.210.0120.00616.63
7.3.200.0080.01819.39
7.3.190.0110.01116.33
7.3.180.0120.00416.45
7.3.170.0130.00416.39
7.3.160.0110.00616.49
7.3.120.0070.01014.83
7.3.110.0030.01414.84
7.3.100.0000.01514.83
7.3.90.0080.00814.58
7.3.80.0030.01314.95
7.3.70.0040.01114.76
7.3.60.0130.00014.93
7.3.50.0060.00914.83
7.3.40.0040.00414.76
7.3.30.0070.00714.61
7.3.20.0060.00616.62
7.3.10.0090.00616.68
7.3.00.0060.00916.56
7.2.330.0080.00916.50
7.2.320.0080.00816.83
7.2.310.0100.01016.73
7.2.300.0110.00716.73
7.2.290.0160.00316.48
7.2.250.0090.00915.04
7.2.240.0060.01015.16
7.2.230.0030.00915.23
7.2.220.0060.00915.05
7.2.210.0000.01414.74
7.2.200.0060.00915.02
7.2.190.0060.00615.18
7.2.180.0030.00815.22
7.2.170.0070.00415.07
7.2.160.0000.01514.73
7.2.150.0000.01716.71
7.2.140.0100.00716.74
7.2.130.0040.00716.63
7.2.120.0030.01016.81
7.2.110.0050.00516.55
7.2.100.0040.01116.85
7.2.90.0070.00716.69
7.2.80.0030.00716.77
7.2.70.0060.00617.04
7.2.60.0090.00316.83
7.2.50.0060.00916.69
7.2.40.0070.00416.93
7.2.30.0000.01017.07
7.2.20.0060.00616.93
7.2.10.0030.00917.02
7.2.00.0050.00718.21
7.1.330.0070.01015.55
7.1.320.0040.01115.70
7.1.310.0080.00415.93
7.1.300.0060.00915.78
7.1.290.0000.01415.85
7.1.280.0000.00815.88
7.1.270.0060.00615.54
7.1.260.0070.01015.91
7.1.250.0120.00015.80
7.1.240.0040.00715.99
7.1.230.0000.01515.55
7.1.220.0090.00015.59
7.1.210.0070.00715.90
7.1.200.0060.00715.68
7.1.190.0030.00815.86
7.1.180.0000.01115.81
7.1.170.0050.00515.59
7.1.160.0050.00515.87
7.1.150.0080.00015.91
7.1.140.0070.00715.63
7.1.130.0030.01215.80
7.1.120.0060.00615.82
7.1.110.0000.01315.67
7.1.100.0060.00617.02
7.1.90.0030.00615.77
7.1.80.0030.00615.66
7.1.70.0000.01116.56
7.1.60.0090.00517.64
7.1.50.0100.00716.30
7.1.40.0030.01215.82
7.1.30.0140.00015.54
7.1.20.0000.01915.91
7.1.10.0000.01215.68
7.1.00.0030.04519.08
7.0.330.0030.00715.52
7.0.320.0030.01015.46
7.0.310.0030.01315.57
7.0.300.0090.00315.50
7.0.290.0080.00315.45
7.0.280.0060.00615.14
7.0.270.0100.01015.31
7.0.260.0070.00715.25
7.0.250.0060.00615.40
7.0.240.0050.00315.60
7.0.230.0060.00615.51
7.0.220.0030.00715.57
7.0.210.0000.01015.24
7.0.200.0040.00316.12
7.0.190.0100.00715.56
7.0.180.0040.01515.51
7.0.170.0000.01515.38
7.0.160.0000.00915.29
7.0.150.0030.01015.47
7.0.140.0000.04318.70
7.0.130.0100.00715.39
7.0.120.0080.00415.36
7.0.110.0000.01315.39
7.0.100.0060.00815.22
7.0.90.0070.00415.63
7.0.80.0030.01015.34
7.0.70.0040.00815.12
7.0.60.0070.03517.70
7.0.50.0080.03816.72
7.0.40.0140.01816.93
7.0.30.0100.02816.82
7.0.20.0130.02716.68
7.0.10.0070.03416.83
7.0.00.0080.02216.83
5.6.400.0000.01414.26
5.6.390.0040.01114.43
5.6.380.0080.00414.46
5.6.370.0000.01114.20
5.6.360.0060.00614.60
5.6.350.0110.00314.30
5.6.340.0030.00714.05
5.6.330.0030.00914.05
5.6.320.0030.01014.00
5.6.310.0110.00314.49
5.6.300.0040.01114.36
5.6.290.0120.00014.54
5.6.280.0020.04217.67
5.6.270.0110.00714.28
5.6.260.0040.01214.31
5.6.250.0000.01414.06
5.6.240.0120.00314.45
5.6.230.0070.00714.11
5.6.220.0070.00714.31
5.6.210.0020.03717.29
5.6.200.0070.03316.42
5.6.190.0070.02517.51
5.6.180.0150.04017.31
5.6.170.0160.02717.44
5.6.160.0030.04517.40
5.6.150.0050.04316.11
5.6.140.0020.04816.28
5.6.130.0100.04016.24
5.6.120.0100.02217.81
5.6.110.0050.04017.58
5.6.100.0070.04417.53
5.6.90.0100.04317.62
5.6.80.0090.03517.13
5.6.70.2340.02417.31
5.6.60.0000.00814.18
5.6.50.0070.00714.21
5.6.40.0030.00714.00
5.6.30.0100.00714.18
5.6.20.0100.00714.13
5.6.10.0000.01014.17
5.6.00.0060.00914.31
5.5.380.0060.01214.05
5.5.370.0040.01614.13
5.5.360.0040.00814.22
5.5.350.0120.02617.35
5.5.340.0020.03216.29
5.5.330.0070.04217.27
5.5.320.0160.02617.35
5.5.310.0120.04417.17
5.5.300.0080.03515.94
5.5.290.0040.02816.07
5.5.280.0070.02317.64
5.5.270.0040.04417.36
5.5.260.0050.04417.63
5.5.250.0100.04217.34
5.5.240.0190.03817.11
5.5.230.0040.00414.27
5.5.220.0040.00714.12
5.5.210.0000.01414.24
5.5.200.0040.01113.89
5.5.190.0100.00714.08
5.5.180.0060.00614.02
5.5.170.0090.00614.19
5.5.160.0000.01414.14
5.5.150.0090.00614.28
5.5.140.0080.00014.33
5.5.130.0060.00314.25
5.5.120.0090.00613.78
5.5.110.0070.00713.75
5.5.100.0040.00414.05
5.5.90.0080.00414.27
5.5.80.0070.01014.16
5.5.70.0070.00414.11
5.5.60.0070.00714.32
5.5.50.0060.00613.83
5.5.40.0030.01014.25
5.5.30.0060.00314.12
5.5.20.0070.00714.05
5.5.10.0100.00314.27
5.5.00.0070.00313.96
5.4.450.0360.03615.24
5.4.440.0400.03815.14
5.4.430.0100.03715.19
5.4.420.0050.03715.23
5.4.410.0020.03515.08
5.4.400.0250.02614.83
5.4.390.0450.02715.04
5.4.380.0270.02214.56
5.4.370.0170.02914.74
5.4.360.0200.03214.57
5.4.350.0200.02814.92
5.4.340.0170.02814.75
5.4.330.0000.01010.88
5.4.320.0070.02211.79
5.4.310.0030.02411.75
5.4.300.0060.02011.83
5.4.290.0040.02711.52
5.4.280.0050.02011.63
5.4.270.0040.02311.67
5.4.260.0040.02511.72
5.4.250.0050.02611.51
5.4.240.0040.02311.65
5.4.230.0070.02011.72
5.4.220.0060.02011.49
5.4.210.0070.02011.64
5.4.200.0050.02611.65
5.4.190.0060.02011.62
5.4.180.0060.02011.74
5.4.170.0070.02311.66
5.4.160.0070.01811.48
5.4.150.0080.02111.56
5.4.140.0060.02711.57
5.4.130.0040.02411.56
5.4.120.0050.02811.48
5.4.110.0040.03211.39
5.4.100.0050.02911.33
5.4.90.0060.02311.38
5.4.80.0050.02511.40
5.4.70.0080.01811.48
5.4.60.0040.02411.48
5.4.50.0060.02311.48
5.4.40.0060.02811.52
5.4.30.0060.02311.31
5.4.20.0060.02011.47
5.4.10.0040.03211.38
5.4.00.0020.03311.23
5.3.290.0060.02511.61
5.3.280.0040.02911.45
5.3.270.0040.03311.40
5.3.260.0040.03211.40
5.3.250.0060.02611.52
5.3.240.0040.02411.34
5.3.230.0050.02311.32
5.3.220.0070.02111.32
5.3.210.0030.02711.31
5.3.200.0040.02311.36
5.3.190.0050.02211.53
5.3.180.0040.02311.57
5.3.170.0040.02311.61
5.3.160.0110.03011.46
5.3.150.0040.02411.43
5.3.140.0090.02411.40
5.3.130.0090.02711.53
5.3.120.0070.02211.48
5.3.110.0080.02011.39
5.3.100.0040.02311.27
5.3.90.0030.02411.15
5.3.80.0060.02611.21
5.3.70.0070.02211.19
5.3.60.0070.02711.19
5.3.50.0050.02411.16
5.3.40.0070.02711.15
5.3.30.0080.02011.14
5.3.20.0050.02211.01
5.3.10.0040.03110.91
5.3.00.0090.02610.90
5.2.170.0080.0299.23
5.2.160.0080.0349.23
5.2.150.0090.0409.22
5.2.140.0060.0409.22
5.2.130.0080.0339.18
5.2.120.0070.0339.18
5.2.110.0040.0359.19
5.2.100.0080.0379.19
5.2.90.0050.0469.19
5.2.80.0070.0509.18
5.2.70.0110.0389.18
5.2.60.0040.0409.14
5.2.50.0040.0369.11
5.2.40.0110.0419.08
5.2.30.0050.0499.06
5.2.20.0130.0459.04
5.2.10.0110.0348.95
5.2.00.0050.0418.82
5.1.60.0070.0278.09
5.1.50.0080.0238.09
5.1.40.0040.0278.07
5.1.30.0070.0288.43
5.1.20.0050.0298.45
5.1.10.0080.0298.17
5.1.00.0030.0288.17
5.0.50.0080.0176.65
5.0.40.0060.0196.50
5.0.30.0020.0346.32
5.0.20.0020.0266.28
5.0.10.0010.0316.27
5.0.00.0040.0366.26
4.4.90.0060.0194.78
4.4.80.0030.0154.76
4.4.70.0030.0154.76
4.4.60.0030.0154.75
4.4.50.0000.0184.77
4.4.40.0030.0254.71
4.4.30.0040.0144.76
4.4.20.0010.0174.84
4.4.10.0050.0134.84
4.4.00.0030.0254.76
4.3.110.0050.0184.67
4.3.100.0030.0154.66
4.3.90.0040.0134.63
4.3.80.0040.0234.58
4.3.70.0010.0174.63
4.3.60.0040.0134.63
4.3.50.0050.0134.62
4.3.40.0010.0264.54
4.3.30.0030.0153.30
4.3.20.0010.0173.28
4.3.10.0020.0163.23
4.3.00.0270.01010.54

preferences:
62.65 ms | 401 KiB | 5 Q