3v4l.org

run code in 300+ PHP versions simultaneously
<?php header("content-type: text/plain"); class WatchVar { private $data = array(); private $org = array(); private $callbacks = array(); public function __set($name, $value) { if (!array_key_exists($name, $this->data)) { $this->org[$name] = $value; } else { //variable gets changed again! $this->triggerChangedEvent($name, $value); } $this->data[$name] = $value; } public function &__get($name) { if (array_key_exists($name, $this->data)) { if ($this->data[$name] != $this->org[$name]) { //variable has changed, return original //return $this->org[$name]; //or return new state: return $this->data[$name]; } else { //variable has not changed return $this->data[$name]; } } } public function addCallback($name, $lambdaFunc) { $this->callbacks[$name] = $lambdaFunc; } protected function triggerChangedEvent($name, $value) { //$this->data[$name] has been changed! //callback call like: call_user_func($this->callbacks[$name], $value); } } $test = new WatchVar; $test->addCallback('xxx', function($newValue) { echo "xxx has changed to {$newValue}\n"; }); $test->xxx = "aaa"; echo $test->xxx . "\n"; //output: aaa $test->xxx = "bbb"; //output: xxx has changed to bbb echo $test->xxx . "\n"; //output bbb function messyFunction(&$var) { $var->xxx = "test"; } messyFunction($test); //output: nothing, why?

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.0160.00318.43
8.3.50.0120.00522.06
8.3.40.0000.01518.79
8.3.30.0070.00719.17
8.3.20.0000.00720.35
8.3.10.0040.00421.95
8.3.00.0000.00822.43
8.2.180.0120.00916.50
8.2.170.0140.00722.96
8.2.160.0030.01020.93
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0080.00019.36
8.2.110.0080.00022.20
8.2.100.0090.00317.84
8.2.90.0060.00319.14
8.2.80.0000.00917.97
8.2.70.0060.00317.63
8.2.60.0000.01317.68
8.2.50.0040.00418.07
8.2.40.0000.00818.22
8.2.30.0000.00718.15
8.2.20.0000.00917.75
8.2.10.0080.00017.79
8.2.00.0000.00817.66
8.1.280.0030.01725.92
8.1.270.0070.00022.14
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0040.00423.91
8.1.230.0090.00318.97
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0040.00417.52
8.1.180.0050.00318.10
8.1.170.0040.00418.59
8.1.160.0040.00421.93
8.1.150.0000.00718.68
8.1.140.0050.00517.55
8.1.130.0030.00317.90
8.1.120.0040.00417.57
8.1.110.0000.00717.40
8.1.100.0040.00417.51
8.1.90.0000.00717.37
8.1.80.0040.00317.39
8.1.70.0070.00017.55
8.1.60.0000.00817.54
8.1.50.0000.00717.57
8.1.40.0040.00417.55
8.1.30.0030.00617.65
8.1.20.0080.00017.74
8.1.10.0040.00417.58
8.1.00.0030.00617.49
8.0.300.0050.00218.77
8.0.290.0000.00817.15
8.0.280.0000.00818.36
8.0.270.0000.00717.21
8.0.260.0030.00316.78
8.0.250.0000.00717.06
8.0.240.0000.00717.00
8.0.230.0060.00316.85
8.0.220.0030.00316.95
8.0.210.0050.00316.88
8.0.200.0060.00016.88
8.0.190.0000.00717.02
8.0.180.0000.00716.98
8.0.170.0060.00316.95
8.0.160.0060.00316.80
8.0.150.0000.00716.82
8.0.140.0040.00416.96
8.0.130.0060.00013.36
8.0.120.0040.00416.88
8.0.110.0050.00316.92
8.0.100.0040.00416.77
8.0.90.0040.00416.80
8.0.80.0060.00916.91
8.0.70.0040.00416.81
8.0.60.0000.00816.98
8.0.50.0040.00416.78
8.0.30.0060.01717.12
8.0.20.0110.01117.40
8.0.10.0070.00017.03
8.0.00.0090.00916.85
7.4.330.0000.00515.07
7.4.320.0000.00716.63
7.4.300.0000.00616.63
7.4.290.0000.00716.45
7.4.280.0090.00016.53
7.4.270.0070.00016.55
7.4.260.0030.00316.51
7.4.250.0040.00416.37
7.4.240.0030.00516.48
7.4.230.0000.00716.35
7.4.220.0120.00616.70
7.4.210.0070.01016.63
7.4.200.0030.00416.61
7.4.190.0000.00716.44
7.4.160.0160.00016.54
7.4.150.0100.00717.40
7.4.140.0060.00817.86
7.4.130.0150.00316.60
7.4.120.0100.01016.52
7.4.110.0070.01016.42
7.4.100.0030.01416.38
7.4.90.0120.00616.61
7.4.80.0130.00419.39
7.4.70.0180.00016.64
7.4.60.0060.01016.46
7.4.50.0080.00016.54
7.4.40.0030.01422.77
7.4.30.0110.00716.60
7.4.10.0070.01114.95
7.4.00.0060.01114.98
7.3.330.0000.00613.33
7.3.320.0000.00513.36
7.3.310.0000.00916.23
7.3.300.0030.00316.38
7.3.290.0150.00616.38
7.3.280.0060.01116.35
7.3.270.0110.00717.40
7.3.260.0030.01416.73
7.3.250.0050.01316.50
7.3.240.0090.00616.34
7.3.230.0060.01116.46
7.3.210.0120.00616.41
7.3.200.0040.01519.39
7.3.190.0060.01016.51
7.3.180.0090.00916.41
7.3.170.0120.00916.47
7.3.160.0000.01716.38
7.3.130.0100.00714.64
7.3.120.0020.01414.98
7.3.110.0130.00614.65
7.3.100.0040.01114.51
7.3.90.0140.00414.81
7.3.80.0120.00014.86
7.3.70.0040.01114.91
7.3.60.0080.00314.55
7.3.50.0080.00414.69
7.3.40.0000.01414.69
7.3.30.0030.00914.82
7.3.20.0060.00316.70
7.3.10.0080.00816.45
7.3.00.0060.00916.56
7.2.330.0090.00916.83
7.2.320.0090.00916.86
7.2.310.0090.00916.74
7.2.300.0160.01016.57
7.2.290.0030.01316.60
7.2.260.0150.00315.16
7.2.250.0090.00815.08
7.2.240.0030.01315.04
7.2.230.0030.01015.38
7.2.220.0120.00314.91
7.2.210.0060.00315.14
7.2.200.0040.01515.22
7.2.190.0030.01014.96
7.2.180.0150.00014.73
7.2.170.0070.00315.05
7.2.160.0030.00914.89
7.2.150.0030.01317.01
7.2.140.0070.00317.03
7.2.130.0120.00516.85
7.2.120.0090.00816.86
7.2.110.0070.00916.77
7.2.100.0050.01016.90
7.2.90.0080.00716.92
7.2.80.0130.00416.94
7.2.70.0090.01016.89
7.2.60.0090.00616.94
7.2.50.0050.00816.97
7.2.40.0070.01217.00
7.2.30.0070.00816.85
7.2.20.0070.00816.90
7.2.10.0100.00716.90
7.2.00.0100.00616.94
7.1.330.0030.01015.79
7.1.320.0030.01215.96
7.1.310.0030.01315.78
7.1.300.0040.00415.91
7.1.290.0000.01316.00
7.1.280.0090.00015.91
7.1.270.0030.01315.85
7.1.260.0090.00615.75
7.1.250.0050.00915.60
7.1.240.0130.00615.96
7.1.230.0080.00815.90
7.1.220.0000.00915.89
7.1.210.0000.01415.84
7.1.200.0030.01016.03
7.1.190.0070.00416.01
7.1.180.0090.00015.71
7.1.170.0040.00815.65
7.1.160.0030.01115.95
7.1.150.0030.01015.69
7.1.140.0030.00715.97
7.1.130.0040.01215.96
7.1.120.0100.00715.85
7.1.110.0090.00916.04
7.1.100.0030.00615.74
7.1.90.0030.00715.88
7.1.80.0060.00915.97
7.1.70.0030.00816.66
7.1.60.0050.01617.84
7.1.50.0080.00816.42
7.1.40.0040.01215.78
7.1.30.0070.01015.77
7.1.20.0040.01215.76
7.1.10.0060.00915.95
7.1.00.0050.04019.10
7.0.330.0040.00415.30
7.0.320.0000.00915.22
7.0.310.0060.00315.52
7.0.300.0030.00915.16
7.0.290.0080.00415.25
7.0.280.0040.01115.26
7.0.270.0000.01815.46
7.0.260.0110.00715.30
7.0.250.0030.00615.44
7.0.240.0070.00415.29
7.0.230.0040.01115.60
7.0.220.0060.00315.17
7.0.210.0000.00815.60
7.0.200.0030.00615.93
7.0.190.0030.01015.52
7.0.180.0030.00615.39
7.0.170.0000.00915.45
7.0.160.0030.01215.44
7.0.150.0090.00615.54
7.0.140.0040.03718.72
7.0.130.0060.00315.12
7.0.120.0000.01415.48
7.0.110.0090.00615.55
7.0.100.0100.04017.64
7.0.90.0030.03817.69
7.0.80.0080.04017.67
7.0.70.0290.04017.62
7.0.60.0120.04117.46
7.0.50.0220.03417.86
7.0.40.0080.04316.68
7.0.30.0040.04016.80
7.0.20.0030.05216.81
7.0.10.0100.04516.65
7.0.00.0090.04416.71
5.6.400.0040.00814.31
5.6.390.0060.00814.69
5.6.380.0060.00914.50
5.6.370.0140.00314.52
5.6.360.0060.00314.37
5.6.350.0030.00814.45
5.6.340.0060.00914.63
5.6.330.0130.00614.63
5.6.320.0080.00414.42
5.6.310.0060.01014.77
5.6.300.0120.00014.55
5.6.290.0040.01114.55
5.6.280.0060.04117.84
5.6.270.0090.00614.43
5.6.260.0120.00614.23
5.6.250.0130.04017.60
5.6.240.0060.04417.59
5.6.230.0020.04717.53
5.6.220.0110.03817.63
5.6.210.0060.03917.47
5.6.200.0080.04517.82
5.6.190.0070.04517.68
5.6.180.0060.04317.59
5.6.170.0020.03917.69
5.6.160.0100.03717.79
5.6.150.0090.03817.81
5.6.140.0100.03817.72
5.6.130.0070.04417.80
5.6.120.0090.04217.75
5.6.110.0070.03217.80
5.6.100.0090.03817.80
5.6.90.0070.05017.72
5.6.80.0090.04317.34
5.6.70.0050.04417.38
5.6.60.0100.04017.46
5.6.50.0110.04017.41
5.6.40.0080.03517.30
5.6.30.0040.02317.34
5.6.20.0080.03017.39
5.6.10.0060.04617.47
5.6.00.0150.03717.37
5.5.380.0060.03417.60
5.5.370.0160.03917.59
5.5.360.0110.03317.43
5.5.350.0070.04617.48
5.5.340.0060.02817.51
5.5.330.0070.04817.53
5.5.320.0100.04517.77
5.5.310.0050.04317.79
5.5.300.0050.04717.75
5.5.290.0110.03817.55
5.5.280.0050.04717.75
5.5.270.0020.03417.58
5.5.260.0030.03817.55
5.5.250.0020.04717.46
5.5.240.0060.04717.34
5.5.230.0110.04017.41
5.5.220.0090.04017.20
5.5.210.0050.04317.28
5.5.200.0080.04117.21
5.5.190.0020.02717.46
5.5.180.0120.03817.38
5.5.170.0080.00814.28
5.5.160.0080.04217.29
5.5.150.0050.04217.22
5.5.140.0100.02217.14
5.5.130.0100.03017.29
5.5.120.0030.04417.24
5.5.110.0100.03517.37
5.5.100.0030.04717.28
5.5.90.0060.04217.09
5.5.80.0070.04217.21
5.5.70.0080.04117.29
5.5.60.0050.04317.26
5.5.50.0020.04417.22
5.5.40.0080.03917.30
5.5.30.0120.02017.16
5.5.20.0080.04317.24
5.5.10.0030.04717.29
5.5.00.0080.04017.26
5.4.450.0080.04015.37
5.4.440.0070.02715.36
5.4.430.0070.03915.27
5.4.420.0010.04115.29
5.4.410.0050.04115.04
5.4.400.0080.03515.15
5.4.390.0030.04215.09
5.4.380.0060.03915.16
5.4.370.0080.04215.22
5.4.360.0100.03715.03
5.4.350.0020.02415.23
5.4.340.0100.03815.07
5.4.330.0040.00411.00
5.4.320.0060.04614.93
5.4.310.0030.04215.05
5.4.300.0030.03914.98
5.4.290.0050.03715.13
5.4.280.0070.04115.09
5.4.270.0000.04715.09
5.4.260.0070.03015.09
5.4.250.0030.04015.19
5.4.240.0050.04615.13
5.4.230.0120.03715.00
5.4.220.0080.04215.12
5.4.210.0140.03015.20
5.4.200.0100.03515.12
5.4.190.0030.03815.04
5.4.180.0100.03715.25
5.4.170.0050.04115.19
5.4.160.0020.04214.99
5.4.150.0050.02714.97
5.4.140.0070.03913.83
5.4.130.0100.03313.83
5.4.120.0030.03913.92
5.4.110.0070.03713.81
5.4.100.0050.03813.81
5.4.90.0110.03513.98
5.4.80.0100.03213.98
5.4.70.0030.04213.85
5.4.60.0020.04613.98
5.4.50.0050.03513.63
5.4.40.0000.04413.96
5.4.30.0030.03713.71
5.4.20.0050.03713.78
5.4.10.0050.04113.75
5.4.00.0150.03313.43
5.3.290.0030.04212.74
5.3.280.0070.04112.53
5.3.270.0050.04212.69
5.3.260.0050.04012.60
5.3.250.0050.04212.63
5.3.240.0060.04012.59
5.3.230.0070.03912.47
5.3.220.0070.03912.40
5.3.210.0090.02912.60
5.3.200.0060.03312.66
5.3.190.0070.03912.63
5.3.180.0100.02012.63
5.3.170.0050.03912.71
5.3.160.0030.04012.64
5.3.150.0070.04212.72
5.3.140.0050.04012.61
5.3.130.0070.02712.63
5.3.120.0050.03212.66
5.3.110.0080.03512.68
5.3.100.0080.03212.43
5.3.90.0020.04112.33
5.3.80.0070.02512.29
5.3.70.0040.02012.29
5.3.60.0020.02412.25
5.3.50.0020.02212.31
5.3.40.0020.02512.25
5.3.30.0050.02212.27
5.3.20.0070.01712.20
5.3.10.0050.01812.13
5.3.00.0050.02012.03
5.2.170.0030.03311.29
5.2.160.0030.02711.21
5.2.150.0000.04011.04
5.2.140.0000.03311.16
5.2.130.0030.02711.14
5.2.120.0000.02711.02
5.2.110.0000.02711.02
5.2.100.0000.03011.19
5.2.90.0000.03011.24
5.2.80.0000.03311.16
5.2.70.0000.03011.18
5.2.60.0170.04011.14
5.2.50.0030.03011.17
5.2.40.0030.03010.87
5.2.30.0000.03011.02
5.2.20.0030.02711.04
5.2.10.0030.02310.93
5.2.00.0030.03010.79
5.1.60.0100.05010.01
5.1.50.0030.04010.11
5.1.40.0100.03010.11
5.1.30.0000.02710.38
5.1.20.0000.02710.38
5.1.10.0130.0409.98
5.1.00.0030.03010.20
5.0.50.0030.0209.78
5.0.40.0030.0209.78
5.0.30.0030.0309.78
5.0.20.0070.0209.78
5.0.10.0030.0209.78
5.0.00.0070.0479.78
4.4.90.0030.0279.78
4.4.80.0030.0179.78
4.4.70.0030.0209.78
4.4.60.0000.0339.78
4.4.50.0030.0179.78
4.4.40.0000.0509.78
4.4.30.0000.0179.78
4.4.20.0070.0279.78
4.4.10.0070.0209.78
4.4.00.0000.0309.78
4.3.110.0000.0179.78
4.3.100.0000.0179.78
4.3.90.0000.0239.78
4.3.80.0030.0209.78
4.3.70.0030.0179.78
4.3.60.0000.0179.78
4.3.50.0000.0139.78
4.3.40.0070.0409.78
4.3.30.0000.0179.78
4.3.20.0030.0139.78
4.3.10.0000.0339.78
4.3.00.0000.0139.78

preferences:
37.48 ms | 401 KiB | 5 Q