3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Coalescing { protected $attributes = [ 'attribute1' => 'value1', ]; public function __get($name) { print "GET\n"; if (array_key_exists($name, $this->attributes)) { return $this->attributes[$name]; } trigger_error("Property $name does not exist"); return null; } public function __isset($name) { print "ISSET\n"; return array_key_exists($name, $this->attributes); } } $coal = new Coalescing(); version_compare(PHP_VERSION, "7.0", ">=") && eval('var_dump($coal->attribute1 ?? "default");'); //GET //string(6) "value1" version_compare(PHP_VERSION, "7.0", ">=") && eval('var_dump($coal->attribute2 ?? "default");'); //GET //PHP Notice: Property attribute2 does not exist in /var/www/html/test.php on line 23 //PHP Stack trace: //PHP 1. {main}() /var/www/html/test.php:0 //PHP 2. Coalescing->__get() /var/www/html/test.php:41 //PHP 3. trigger_error() /var/www/html/test.php:23 ///var/www/html/test.php:41: //string(7) "default"

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.40.0120.00618.67
8.3.30.0070.00718.70
8.3.20.0080.00020.20
8.3.10.0000.00921.73
8.3.00.0050.00521.85
8.2.170.0070.00722.96
8.2.160.0100.00720.38
8.2.150.0080.00024.18
8.2.140.0070.00024.66
8.2.130.0070.00720.63
8.2.120.0040.00426.35
8.2.110.0090.00019.27
8.2.100.0110.00017.93
8.2.90.0030.00519.25
8.2.80.0060.00317.97
8.2.70.0060.00317.61
8.2.60.0040.00418.04
8.2.50.0050.00318.09
8.2.40.0040.00420.64
8.2.30.0000.00719.50
8.2.20.0000.00717.71
8.2.10.0040.00418.04
8.2.00.0000.00718.15
8.1.270.0000.00822.19
8.1.260.0060.00328.09
8.1.250.0040.00428.09
8.1.240.0040.00422.55
8.1.230.0110.00017.83
8.1.220.0030.00617.74
8.1.210.0050.00318.77
8.1.200.0000.00817.35
8.1.190.0030.00617.13
8.1.180.0000.00918.10
8.1.170.0030.00518.59
8.1.160.0040.00420.83
8.1.150.0000.00820.66
8.1.140.0000.00819.54
8.1.130.0000.00717.77
8.1.120.0060.00317.39
8.1.110.0040.00417.38
8.1.100.0040.00417.50
8.1.90.0050.00217.47
8.1.80.0030.00517.45
8.1.70.0000.00717.41
8.1.60.0030.00517.63
8.1.50.0000.00817.45
8.1.40.0040.00417.46
8.1.30.0000.00817.60
8.1.20.0030.00517.46
8.1.10.0030.00517.61
8.1.00.0040.00417.44
8.0.300.0030.00518.77
8.0.290.0040.00416.75
8.0.280.0000.00718.48
8.0.270.0070.00017.26
8.0.260.0040.00417.34
8.0.250.0030.00516.84
8.0.240.0030.00516.84
8.0.230.0000.00716.96
8.0.220.0000.00716.79
8.0.210.0000.00716.89
8.0.200.0030.00316.96
8.0.190.0060.00317.00
8.0.180.0060.00316.87
8.0.170.0080.00016.91
8.0.160.0040.00416.81
8.0.150.0000.00816.69
8.0.140.0000.00916.77
8.0.130.0030.00313.34
8.0.120.0030.00716.78
8.0.110.0000.00716.87
8.0.100.0000.00716.88
8.0.90.0000.00816.89
8.0.80.0120.00316.84
8.0.70.0000.00816.84
8.0.60.0070.00316.77
8.0.50.0040.00416.92
8.0.30.0100.00817.27
8.0.20.0110.00817.40
8.0.10.0040.00417.11
8.0.00.0170.01316.83
7.4.330.0000.00616.77
7.4.320.0000.00616.58
7.4.300.0040.00416.49
7.4.290.0040.00416.48
7.4.280.0030.00616.55
7.4.270.0030.00316.46
7.4.260.0040.00416.50
7.4.250.0040.00416.37
7.4.240.0050.00216.61
7.4.230.0070.00016.31
7.4.220.0090.00916.55
7.4.210.0050.01116.59
7.4.200.0030.00316.48
7.4.160.0070.01316.52
7.4.150.0140.00617.40
7.4.140.0160.02117.86
7.4.130.0070.01016.49
7.4.120.0090.00916.51
7.4.110.0100.00616.54
7.4.100.0140.00716.63
7.4.90.0130.00616.57
7.4.80.0160.00819.39
7.4.70.0140.00316.71
7.4.60.0100.00716.51
7.4.50.0060.00916.38
7.4.40.0030.01216.45
7.4.30.0130.00716.51
7.4.00.0030.01315.13
7.3.330.0060.00013.20
7.3.320.0030.00313.20
7.3.310.0030.00316.41
7.3.300.0000.00616.34
7.3.290.0040.00416.38
7.3.280.0030.01416.36
7.3.270.0150.00317.40
7.3.260.0210.00316.45
7.3.250.0140.00916.40
7.3.240.0090.00716.55
7.3.230.0140.00316.43
7.3.210.0060.01016.32
7.3.200.0130.01019.39
7.3.190.0110.00716.40
7.3.180.0100.00716.59
7.3.170.0140.00616.28
7.3.160.0100.00616.42
7.2.330.0100.01016.72
7.2.320.0100.01616.80
7.2.310.0100.01316.65
7.2.300.0030.01316.70
7.2.290.0090.00616.49
7.2.60.0120.00316.43
7.2.00.0000.01219.47
7.1.200.0030.01015.83
7.1.100.0030.00617.97
7.1.70.0030.00617.03
7.1.60.0100.00619.40
7.1.50.0100.01016.72
7.1.00.0130.06322.32
7.0.200.3360.00714.88
7.0.60.0300.05319.92
7.0.50.0070.08017.86
7.0.40.0030.06320.23
7.0.30.0100.04720.32
7.0.20.0400.07720.17
7.0.10.0070.07720.09
7.0.00.0070.05720.16
5.6.280.0000.03721.11
5.6.210.0070.04020.67
5.6.200.0070.08718.25
5.6.190.0070.08320.79
5.6.180.0230.04320.48
5.6.170.0370.06720.54
5.6.160.0070.08020.54
5.6.150.0030.04018.29
5.6.140.0070.08718.11
5.6.130.0030.04318.24
5.6.120.0030.04321.01
5.6.110.0100.06721.14
5.6.100.0130.06321.14
5.6.90.0100.09021.04
5.6.80.0100.07720.54
5.5.350.0170.02720.41
5.5.340.0000.04318.07
5.5.330.0130.08720.45
5.5.320.0230.06720.31
5.5.310.0270.07720.19
5.5.300.0070.04018.02
5.5.290.0130.07717.94
5.5.280.0130.07720.78
5.5.270.0170.07720.80
5.5.260.0130.04020.74
5.5.250.0100.08320.70
5.5.240.3000.04320.24

preferences:
49.4 ms | 400 KiB | 5 Q