3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Challenge 1: Modify Test::$secret before it's output. Rules:: 1. No use of Reflection API / runkit extension 2. No stopping execution before Test::run() 3. No Exceptions or PHP errors / warnings notices allowed Hints: 1. Caesar 2. Magic methods 3. Requires a new feature of PHP 5.4 */ class Test { private $secret = 'Nyy lbhe Onfr ner orybat gb hf.'; private $callback; final public function run() { call_user_func($this->callback); return $this->secret . PHP_EOL; } public function __set($k, $v) { $key = $v[($v[$v])]; // $v is some kind of weird array $value = $v(); // and a callback! $this->{$key} = $value; } } $test = new Test; // start editing here class Fixer extends ArrayObject { public $k; public $v; public function offsetGet($i) { return $this->k; } public function __construct($k, $v) { $this->k = $k; $this->v = $v; } public function __invoke() { return $this->v; } } $test->foo = new Fixer('callback', function() {}); // modifying secret, but no access to read it $test->foo = new Fixer('secret', 'All your Base are belong to us.'); // end editing here echo $test->run();

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.01018.35
8.3.50.0130.00622.11
8.3.40.0120.00318.96
8.3.30.0100.01019.04
8.3.20.0060.00320.35
8.3.10.0070.00021.96
8.3.00.0060.00322.52
8.2.180.0000.01516.75
8.2.170.0040.01122.96
8.2.160.0030.01019.29
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00419.79
8.2.110.0100.00022.08
8.2.100.0130.00019.57
8.2.90.0000.00819.39
8.2.80.0000.00917.97
8.2.70.0070.00317.63
8.2.60.0080.00017.93
8.2.50.0060.00318.07
8.2.40.0040.00419.84
8.2.30.0000.00718.13
8.2.20.0000.00717.65
8.2.10.0040.00417.68
8.2.00.0040.00417.83
8.1.280.0030.01425.92
8.1.270.0070.00418.66
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0090.00023.86
8.1.230.0090.00318.86
8.1.220.0050.00317.76
8.1.210.0030.00618.77
8.1.200.0030.00617.50
8.1.190.0030.00517.52
8.1.180.0040.00418.75
8.1.170.0040.00418.72
8.1.160.0040.00422.20
8.1.150.0050.00318.59
8.1.140.0030.00617.48
8.1.130.0000.00717.91
8.1.120.0070.00017.52
8.1.110.0000.00717.48
8.1.100.0040.00417.53
8.1.90.0080.00317.47
8.1.80.0000.00717.51
8.1.70.0030.00317.42
8.1.60.0050.00517.55
8.1.50.0000.00817.58
8.1.40.0050.00317.44
8.1.30.0000.00717.67
8.1.20.0030.00517.59
8.1.10.0080.00017.54
8.1.00.0080.00017.52
8.0.300.0040.00418.77
8.0.290.0070.00017.05
8.0.280.0000.00818.46
8.0.270.0000.00817.27
8.0.260.0000.00716.85
8.0.250.0000.00716.99
8.0.240.0000.00816.98
8.0.230.0040.00416.87
8.0.220.0030.00316.91
8.0.210.0000.00716.89
8.0.200.0030.00316.97
8.0.190.0000.00717.00
8.0.180.0040.00416.84
8.0.170.0040.00416.83
8.0.160.0040.00416.93
8.0.150.0070.00016.86
8.0.140.0040.00416.91
8.0.130.0060.00013.30
8.0.120.0050.00316.92
8.0.110.0030.00516.74
8.0.100.0070.00016.94
8.0.90.0000.00716.80
8.0.80.0090.00916.91
8.0.70.0040.00416.97
8.0.60.0000.00716.80
8.0.50.0000.00716.77
8.0.30.0130.00817.14
8.0.20.0160.00417.40
8.0.10.0040.00417.09
8.0.00.0100.00916.89
7.4.330.0040.00015.00
7.4.320.0030.00316.64
7.4.300.0000.00616.69
7.4.290.0100.00016.53
7.4.280.0030.00316.52
7.4.270.0030.00316.57
7.4.260.0030.00316.54
7.4.250.0000.00816.50
7.4.240.0050.00216.60
7.4.230.0000.00616.61
7.4.220.0060.01216.57
7.4.210.0040.01216.54
7.4.200.0030.00316.58
7.4.190.0000.00816.66
7.4.160.0070.01016.45
7.4.150.0060.01817.40
7.4.140.0160.00517.86
7.4.130.0100.00716.40
7.4.120.0100.00716.62
7.4.110.0100.01016.30
7.4.100.0070.01016.42
7.4.90.0140.00716.61
7.4.80.0150.00419.39
7.4.70.0120.00916.53
7.4.60.0100.00716.57
7.4.50.0080.00016.52
7.4.40.0040.01422.77
7.4.30.0090.00616.41
7.4.00.0040.01114.81
7.3.330.0050.00013.20
7.3.320.0000.00613.19
7.3.310.0040.00416.44
7.3.300.0030.00316.43
7.3.290.0130.00616.27
7.3.280.0100.00816.36
7.3.270.0090.01217.40
7.3.260.0120.00616.57
7.3.250.0140.00816.63
7.3.240.0070.01616.42
7.3.230.0120.01216.60
7.3.210.0030.01316.50
7.3.200.0100.01119.39
7.3.190.0040.01516.65
7.3.180.0060.01016.51
7.3.170.0040.01216.73
7.3.160.0060.00916.58
7.3.120.0050.01214.86
7.3.110.0070.01014.91
7.3.100.0070.01114.98
7.3.90.0030.01014.61
7.3.80.0100.00314.99
7.3.70.0100.00714.81
7.3.60.0030.01014.83
7.3.50.0040.00814.84
7.3.40.0000.00915.08
7.3.30.0000.00814.78
7.3.20.0040.00816.82
7.3.10.0070.00716.67
7.3.00.0030.01116.67
7.2.330.0140.00416.48
7.2.320.0090.00916.77
7.2.310.0120.00916.40
7.2.300.0080.00816.61
7.2.290.0100.00616.88
7.2.250.0000.01915.40
7.2.240.0060.01215.06
7.2.230.0030.01814.62
7.2.220.0030.01415.21
7.2.210.0110.00315.15
7.2.200.0120.00315.32
7.2.190.0090.00614.96
7.2.180.0060.00315.14
7.2.170.0000.01114.96
7.2.130.0110.00416.84
7.2.120.0150.00417.09
7.2.110.0000.01217.01
7.2.100.0030.01316.64
7.2.90.0150.00417.02
7.2.80.0090.00317.13
7.2.70.0030.00816.78
7.2.60.0070.00716.81
7.2.50.0060.00616.73
7.2.40.0090.00617.09
7.2.30.0080.00417.04
7.2.20.0060.00916.95
7.2.10.0120.00616.73
7.2.00.0040.01118.13
7.1.330.0070.00415.64
7.1.320.0150.00015.68
7.1.310.0030.00615.91
7.1.300.0060.00615.59
7.1.290.0060.00315.98
7.1.280.0060.00615.56
7.1.270.0040.00715.54
7.1.260.0060.00915.86
7.1.250.0100.01015.80
7.1.240.0070.00315.51
7.1.230.0060.01215.86
7.1.220.0070.00615.77
7.1.210.0040.00815.41
7.1.200.0030.00815.70
7.1.190.0090.00615.55
7.1.180.0090.00615.75
7.1.170.0060.00915.58
7.1.160.0030.01015.95
7.1.150.0050.00816.04
7.1.140.0060.00615.79
7.1.130.0000.00915.70
7.1.120.0070.00715.53
7.1.110.0000.00915.75
7.1.100.0060.00816.84
7.1.90.0130.00615.68
7.1.80.0110.00715.75
7.1.70.0040.00716.46
7.1.60.0050.01217.84
7.1.50.0080.01116.24
7.1.40.0120.00415.76
7.1.30.0090.00015.56
7.1.20.0150.00315.82
7.1.10.0110.00415.74
7.1.00.0030.04119.11
7.0.330.0060.00315.25
7.0.320.0060.00915.12
7.0.310.0040.00815.01
7.0.300.0100.00715.36
7.0.290.0000.01215.42
7.0.280.0030.00715.44
7.0.270.0070.00715.22
7.0.260.0090.00615.32
7.0.250.0090.00615.34
7.0.240.0140.00015.27
7.0.230.0050.00515.34
7.0.220.0070.00715.34
7.0.210.0000.01215.50
7.0.200.0020.00816.06
7.0.190.0030.01315.48
7.0.180.0100.00315.29
7.0.170.0080.00415.43
7.0.160.0070.00715.21
7.0.150.0070.00715.38
7.0.140.0030.03818.49
7.0.130.0040.01115.40
7.0.120.0100.00315.28
7.0.110.0070.01015.41
7.0.100.0030.00615.10
7.0.90.0100.00615.38
7.0.80.0000.01215.40
7.0.70.2320.01517.74
7.0.60.0020.04117.74
7.0.50.0100.04216.73
7.0.40.0090.04316.87
7.0.30.0070.03916.83
7.0.20.0100.04016.78
7.0.10.0150.03816.74
7.0.00.0080.04016.65
5.6.380.0030.00914.33
5.6.370.0130.00014.75
5.6.360.0090.00314.59
5.6.350.0090.00914.23
5.6.340.0060.00914.44
5.6.330.0060.00614.33
5.6.320.0060.00914.11
5.6.310.0030.01414.43
5.6.300.0040.01114.46
5.6.290.0070.00714.71
5.6.280.0050.03817.79
5.6.270.0030.00714.56
5.6.260.0030.00714.64
5.6.250.0070.01014.54
5.6.240.0080.00014.15
5.6.230.0030.01014.40
5.6.220.0090.00614.38
5.6.210.0070.04717.39
5.6.200.0050.04816.26
5.6.190.0050.03417.40
5.6.180.0140.03117.44
5.6.170.0130.03317.46
5.6.160.0070.04417.32
5.6.150.0080.03616.27
5.6.140.0080.03516.22
5.6.130.0050.02716.22
5.6.120.0110.03217.79
5.6.110.0050.04517.58
5.6.100.0030.03817.67
5.6.90.0030.02517.64
5.6.80.0050.02617.29
5.6.70.0170.03517.45
5.6.60.0060.00614.07
5.6.50.0040.00814.47
5.6.40.0100.00314.36
5.6.30.0080.00614.34
5.6.20.0090.00914.26
5.6.10.0030.01414.37
5.6.00.0040.01114.31
5.5.380.0030.00911.05
5.5.370.0070.00311.18
5.5.360.0040.00911.19
5.5.350.0070.04315.66
5.5.340.0030.02614.51
5.5.330.0040.04515.62
5.5.320.0070.02515.67
5.5.310.0130.03515.56
5.5.300.0090.03014.56
5.5.290.0070.02214.48
5.5.280.0060.02516.00
5.5.270.0030.04615.95
5.5.260.0080.03616.16
5.5.250.0060.04315.75
5.5.240.0030.03115.68
5.5.230.0000.00911.22
5.5.220.0000.01010.98
5.5.210.0130.00010.68
5.5.200.0070.00311.08
5.5.190.0130.00011.03
5.5.180.0040.00711.09
5.5.170.0060.00610.86
5.5.160.0060.00611.14
5.5.150.0050.00510.96
5.5.140.0000.01211.12
5.5.130.0070.00010.69
5.5.120.0000.01211.04
5.5.110.0060.00311.07
5.5.100.0040.00710.89
5.5.90.0030.00310.86
5.5.80.0080.00311.18
5.5.70.0040.00711.20
5.5.60.0070.00711.22
5.5.50.0070.00711.27
5.5.40.0040.00711.19
5.5.30.0040.00911.23
5.5.20.0060.00611.17
5.5.10.0040.01011.05
5.5.00.0040.01311.10
5.4.450.1550.02015.26
5.4.440.1550.02315.34
5.4.430.1440.02215.27
5.4.420.1830.02515.21
5.4.410.1430.02215.00
5.4.400.1570.01815.07
5.4.390.1200.02415.20
5.4.380.1280.02215.11
5.4.370.1250.01815.16
5.4.360.1600.01715.00
5.4.350.1330.02415.10
5.4.340.1370.02314.93
5.4.330.0030.01011.11
5.4.320.1410.02215.28
5.4.310.1660.01915.07
5.4.300.1650.02015.20
5.4.290.1660.01715.19
5.4.280.1520.02014.98
5.4.270.1680.02315.02
5.4.260.1630.02214.91
5.4.250.1730.02514.92
5.4.240.1520.02114.94
5.4.230.1520.02214.89
5.4.220.1390.02215.04
5.4.210.1200.02814.84
5.4.200.1680.02014.81
5.4.190.1330.02314.89
5.4.180.1380.02515.02
5.4.170.1420.01814.84
5.4.160.1630.02014.84
5.4.150.1650.02314.70
5.4.140.1330.02713.82
5.4.130.1480.02613.63
5.4.120.1690.01813.75
5.4.110.1650.02213.87
5.4.100.1730.02513.94
5.4.90.1520.02213.68
5.4.80.1660.01713.72
5.4.70.1460.01813.71
5.4.60.1410.02513.45
5.4.50.1700.02413.63
5.4.40.1550.02013.85
5.4.30.1570.02413.68
5.4.20.1130.01813.86
5.4.10.1420.02513.87
5.4.00.1630.01813.46
5.3.290.1780.01812.74
5.3.280.1350.02412.46
5.3.270.1590.02212.54
5.3.260.1630.01812.57
5.3.250.1610.02012.67
5.3.240.1440.01712.64
5.3.230.1720.02012.59
5.3.220.1500.01912.50
5.3.210.1370.02712.67
5.3.200.1500.02112.58
5.3.190.1790.02412.54
5.3.180.1510.02112.64
5.3.170.1640.02212.78
5.3.160.1630.02012.71
5.3.150.1700.02412.63
5.3.140.1370.02112.63
5.3.130.1650.01912.49
5.3.120.1400.01912.46
5.3.110.1180.02312.51
5.3.100.1660.02312.29
5.3.90.1650.02012.29
5.3.80.1830.02412.21
5.3.70.1600.02512.28
5.3.60.1410.01612.21
5.3.50.1430.02012.33
5.3.40.1690.01512.37
5.3.30.1560.02212.19
5.3.20.1480.02012.01
5.3.10.1220.02212.05
5.3.00.1320.01512.09
5.2.170.1200.01710.67
5.2.160.1340.01910.51
5.2.150.1190.01510.60
5.2.140.1090.01710.52
5.2.130.1220.01810.50
5.2.120.1300.01410.49
5.2.110.0950.02010.49
5.2.100.1090.01710.55
5.2.90.1290.01710.50
5.2.80.1390.01310.50
5.2.70.1320.01810.57
5.2.60.1180.02110.55
5.2.50.1150.01710.54
5.2.40.0820.01510.46
5.2.30.0900.01510.46
5.2.20.0990.01610.52
5.2.10.0950.01610.46
5.2.00.0960.01710.46
5.1.60.0930.01410.46
5.1.50.1010.01310.46
5.1.40.1060.01010.46
5.1.30.0900.01710.46
5.1.20.0830.01810.46
5.1.10.1090.01510.46
5.1.00.0800.01310.46
5.0.50.0520.01010.46
5.0.40.0470.01210.46
5.0.30.0580.02010.46
5.0.20.0550.00810.46
5.0.10.0630.01310.46
5.0.00.0580.01510.46
4.4.90.0570.01210.46
4.4.80.0530.00810.46
4.4.70.0650.00510.46
4.4.60.0450.01210.46
4.4.50.0600.01110.46
4.4.40.0530.01310.46
4.4.30.0500.01210.46
4.4.20.0330.01210.46
4.4.10.0400.01010.46
4.4.00.0600.02110.46
4.3.110.0580.01010.46
4.3.100.0550.01310.46
4.3.90.0600.00810.46
4.3.80.0450.02010.46
4.3.70.0330.01110.46
4.3.60.0590.01010.46
4.3.50.0580.01010.46
4.3.40.0530.01310.46
4.3.30.0320.01410.46
4.3.20.0150.01810.46
4.3.10.0280.00910.46
4.3.00.0190.01310.46

preferences:
43.93 ms | 401 KiB | 5 Q