3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Immutable { private static $sealed = array(); public function __set($name, $value) { //if (isset(self::$sealed[spl_object_hash($this)])) { throw new Exception("can't touch this, nah nah nuh nahhh"); //} $this->$name = $value; } public function __get($name) { return $this->$name; } protected function finalize() { self::$sealed[spl_object_hash($this)] = true; // You could probably implement a __destruct to clean up and avoid leaking memory here, // but who gaf anyway this is just an example } } class ImmutableThingy { use Immutable; protected $foo; public function __construct($foo) { $this->foo = $foo; //$this->finalize(); } } $thing = new ImmutableThingy("bar"); var_dump($thing, $thing->foo); $thing->foo = 'baz'; var_dump($thing, $thing->foo);

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.00716.75
8.3.50.0120.00416.30
8.3.40.0150.00018.84
8.3.30.0080.00819.00
8.3.20.0030.00621.97
8.3.10.0040.00421.81
8.3.00.0060.00321.77
8.2.180.0040.01118.41
8.2.170.0090.00922.96
8.2.160.0060.00920.44
8.2.150.0030.00624.18
8.2.140.0050.00224.66
8.2.130.0060.00320.75
8.2.120.0050.00326.35
8.2.110.0100.00019.33
8.2.100.0080.00417.93
8.2.90.0030.00618.96
8.2.80.0040.00417.97
8.2.70.0040.00417.62
8.2.60.0110.00017.91
8.2.50.0000.00818.09
8.2.40.0040.00422.22
8.2.30.0080.00019.32
8.2.20.0040.00417.77
8.2.10.0020.00518.09
8.2.00.0000.00718.07
8.1.280.0190.00025.92
8.1.270.0040.00422.20
8.1.260.0040.00428.09
8.1.250.0000.00728.09
8.1.240.0090.00022.09
8.1.230.0110.00017.70
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0090.00017.35
8.1.190.0030.00617.23
8.1.180.0040.00418.10
8.1.170.0030.00618.50
8.1.160.0050.00320.70
8.1.150.0030.00519.04
8.1.140.0000.00819.51
8.1.130.0070.00017.71
8.1.120.0000.00717.38
8.1.110.0050.00217.39
8.1.100.0000.00717.50
8.1.90.0000.00817.52
8.1.80.0000.00817.38
8.1.70.0030.00317.52
8.1.60.0000.00817.66
8.1.50.0030.00617.58
8.1.40.0000.00817.62
8.1.30.0000.00817.76
8.1.20.0040.00417.60
8.1.10.0070.00017.48
8.1.00.0040.00417.46
8.0.300.0080.00018.77
8.0.290.0040.00416.63
8.0.280.0040.00418.48
8.0.270.0000.00717.36
8.0.260.0000.00617.14
8.0.250.0030.00316.96
8.0.240.0050.00217.03
8.0.230.0040.00417.05
8.0.220.0090.00017.01
8.0.210.0000.00817.02
8.0.200.0070.00017.07
8.0.190.0000.00717.03
8.0.180.0000.00816.97
8.0.170.0000.00816.97
8.0.160.0070.00016.97
8.0.150.0000.00716.93
8.0.140.0030.00416.94
8.0.130.0000.00613.34
8.0.120.0030.00516.92
8.0.110.0000.00816.96
8.0.100.0040.00417.04
8.0.90.0000.00716.93
8.0.80.0090.00916.91
8.0.70.0050.00217.04
8.0.60.0050.00316.80
8.0.50.0070.00016.95
8.0.30.0110.00717.21
8.0.20.0110.00817.40
8.0.10.0040.00417.16
8.0.00.0120.00616.83
7.4.330.0020.00216.84
7.4.320.0030.00316.63
7.4.300.0040.00416.63
7.4.290.0040.00416.63
7.4.280.0050.00216.53
7.4.270.0040.00416.55
7.4.260.0030.00316.62
7.4.250.0080.00016.45
7.4.240.0070.00016.64
7.4.230.0030.00316.32
7.4.220.0130.00616.57
7.4.210.0110.00516.63
7.4.200.0000.00716.69
7.4.160.0090.00916.52
7.4.150.0120.00617.40
7.4.140.0050.01317.86
7.4.130.0110.00716.62
7.4.120.0070.01216.48
7.4.110.0080.00816.59
7.4.100.0030.01316.54
7.4.90.0130.00416.55
7.4.80.0160.00719.39
7.4.70.0130.00316.62
7.4.60.0100.01016.50
7.4.50.0000.01116.36
7.4.40.0090.00916.61
7.4.30.0150.00816.58
7.4.00.0070.01015.02
7.3.330.0000.00613.45
7.3.320.0000.00513.22
7.3.310.0070.00016.42
7.3.300.0030.00316.31
7.3.290.0000.00616.33
7.3.280.0060.01116.40
7.3.270.0110.01117.40
7.3.260.0150.00316.50
7.3.250.0120.00716.53
7.3.240.0170.00216.41
7.3.230.0060.00916.39
7.3.210.0120.00616.31
7.3.200.0060.01519.39
7.3.190.0140.00316.57
7.3.180.0080.00816.62
7.3.170.0140.01116.58
7.3.160.0130.01016.50
7.3.10.0060.00916.43
7.3.00.0080.00416.80
7.2.330.0030.01616.77
7.2.320.0150.00616.74
7.2.310.0160.00816.78
7.2.300.0060.01316.51
7.2.290.0130.00316.70
7.2.130.0120.00316.86
7.2.120.0070.00716.87
7.2.110.0040.00416.85
7.2.100.0000.01216.91
7.2.90.0100.00716.76
7.2.80.0090.00616.78
7.2.70.0030.01016.88
7.2.60.0050.00916.98
7.2.50.0120.00016.93
7.2.40.0100.00316.84
7.2.30.0030.00616.50
7.2.20.0030.01017.13
7.2.10.0070.00716.57
7.2.00.0060.00618.03
7.1.250.0040.00415.89
7.1.240.0030.01015.96
7.1.230.0030.00915.79
7.1.220.0040.00715.89
7.1.210.0110.00315.86
7.1.200.0130.00615.52
7.1.190.0090.00615.56
7.1.180.0040.00715.78
7.1.170.0000.01015.77
7.1.160.0060.00615.57
7.1.150.0030.00915.53
7.1.140.0040.00415.66
7.1.130.0060.00915.80
7.1.120.0050.00515.76
7.1.110.0040.00715.93
7.1.100.0030.00816.91
7.1.90.0000.01115.89
7.1.80.0030.00615.99
7.1.70.0020.00816.58
7.1.60.0070.01117.59
7.1.50.0040.01216.34
7.1.40.0100.00616.04
7.1.30.0040.00415.58
7.1.20.0100.00315.44
7.1.10.0040.00415.89
7.1.00.0050.04319.19
7.0.330.0030.01315.39
7.0.320.0030.00615.20
7.0.310.0000.01615.15
7.0.300.0030.01015.20
7.0.290.0060.00615.61
7.0.280.0070.00715.39
7.0.270.0040.00815.16
7.0.260.0030.00615.29
7.0.250.0030.00615.54
7.0.240.0000.01315.26
7.0.230.0070.00315.20
7.0.220.0040.00415.41
7.0.210.0050.00515.24
7.0.200.0300.00515.21
7.0.190.0120.00015.17
7.0.180.0090.00315.45
7.0.170.0060.00915.52
7.0.160.0070.00315.50
7.0.150.0000.01315.16
7.0.140.0040.00815.27
7.0.130.0070.01015.53
7.0.120.0090.00615.18
7.0.110.0090.00015.46
7.0.100.0120.00315.22
7.0.90.0060.01215.27
7.0.80.0000.01515.45
7.0.70.0000.01015.58
7.0.60.0120.04418.69
7.0.50.0090.04216.79
7.0.40.0050.02616.82
7.0.30.0130.04516.71
7.0.20.0190.03916.78
7.0.10.0020.05316.77
7.0.00.0050.03016.59
5.6.380.0100.00314.52
5.6.370.0030.00814.36
5.6.360.0070.00414.50
5.6.350.0070.00714.29
5.6.340.0030.01214.22
5.6.330.0000.00914.20
5.6.320.0110.00314.44
5.6.310.0100.00014.40
5.6.300.0080.00814.31
5.6.290.0040.01114.19
5.6.280.0040.02117.70
5.6.270.0060.00914.36
5.6.260.0090.00614.53
5.6.250.0000.01114.33
5.6.240.0040.00714.30
5.6.230.0070.00714.36
5.6.220.0030.01314.28
5.6.210.0070.04017.46
5.6.200.0080.03216.26
5.6.190.0070.03617.59
5.6.180.0150.03217.60
5.6.170.0200.03917.43
5.6.160.0080.04317.46
5.6.150.0040.02216.31
5.6.140.0070.03216.38
5.6.130.0110.04016.23
5.6.120.0090.03817.79
5.6.110.0120.03817.82
5.6.100.0030.04017.67
5.6.90.0110.03617.70
5.6.80.0050.03817.52
5.6.70.0070.01014.15
5.6.60.0050.00814.30
5.6.50.0080.00514.47
5.6.40.0070.00714.29
5.6.30.0030.00814.22
5.6.20.0060.00614.20
5.6.10.0040.00414.19
5.6.00.0030.01214.26
5.5.380.0040.00411.18
5.5.370.0040.00311.34
5.5.360.0030.01010.87
5.5.350.0100.03315.71
5.5.340.0060.02614.77
5.5.330.0030.04315.88
5.5.320.0170.02215.72
5.5.310.0240.03415.61
5.5.300.0080.04014.63
5.5.290.0050.04514.56
5.5.280.0020.04916.10
5.5.270.0110.02116.01
5.5.260.0030.04215.89
5.5.250.0060.03115.82
5.5.240.1150.02515.61
5.5.230.0030.00311.16
5.5.220.0050.00511.31
5.5.210.0030.00611.27
5.5.200.0040.00411.17
5.5.190.0030.00711.37
5.5.180.0060.00610.81
5.5.170.0000.01111.07
5.5.160.0040.00411.25
5.5.150.0000.01010.96
5.5.140.0070.00411.09
5.5.130.0050.00511.10
5.5.120.0060.00311.22
5.5.110.0000.01010.98
5.5.100.0000.00910.71
5.5.90.0030.00910.99
5.5.80.0030.00711.02
5.5.70.0030.00510.87
5.5.60.0040.00710.95
5.5.50.0070.00310.80
5.5.40.0000.00710.92
5.5.30.0030.00510.95
5.5.20.0040.00811.27
5.5.10.0070.00011.10
5.5.00.0040.00810.97

preferences:
52.55 ms | 401 KiB | 5 Q