3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NotDefined { public function setDirection($direction) { $this->direction = $direction; } public function getDirection() { return $this->direction; } } class PropertyDefined { protected $direction; public function setDirection($direction) { $this->direction = $direction; } public function getDirection() { return $this->direction; } } function getCost($class) { $start = memory_get_usage(); $instance = new $class; $instance->setDirection('asc'); $cost = memory_get_usage() - $start . ' bytes'; unset($instance); return $cost; } // Output the cost WITHOUT a property declared echo 'Not declared' . getCost(NotDefined::class) . PHP_EOL; // Output the cost WITH the property declared echo 'Declared' . getCost(PropertyDefined::class);

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)
7.4.00.0070.01115.11
7.3.120.0070.01014.78
7.3.110.0100.00314.87
7.3.100.0150.00414.99
7.3.90.0040.01114.84
7.3.80.0030.00614.96
7.3.70.0040.00814.70
7.3.60.0100.00014.80
7.3.50.0000.01414.65
7.3.40.0120.00314.91
7.3.30.0110.00414.80
7.3.20.0060.01016.68
7.3.10.0000.01416.68
7.3.00.0000.01616.62
7.2.250.0070.01414.55
7.2.240.0140.00415.14
7.2.230.0000.01515.22
7.2.220.0030.01215.27
7.2.210.0000.01414.84
7.2.200.0060.00615.01
7.2.190.0090.00615.08
7.2.180.0100.00015.09
7.2.170.0090.00615.07
7.2.160.0120.00614.84
7.2.150.0000.01717.00
7.2.140.0040.01116.87
7.2.130.0110.00616.84
7.2.120.0060.00916.94
7.2.110.0070.01016.96
7.2.100.0070.00416.82
7.2.90.0060.00617.04
7.2.80.0070.00316.91
7.2.70.0030.00616.98
7.2.60.0000.01416.78
7.2.50.0000.01316.79
7.2.40.0040.01216.98
7.2.30.0060.00916.80
7.2.20.0050.00516.96
7.2.10.0070.00316.96
7.2.00.0040.01018.17
7.1.330.0030.01315.73
7.1.320.0000.01315.49
7.1.310.0000.01115.93
7.1.300.0040.01115.76
7.1.290.0150.00015.64
7.1.280.0000.00815.73
7.1.270.0090.00615.58
7.1.260.0000.01115.48
7.1.250.0030.00715.74
7.1.240.0000.01515.41
7.1.230.0030.00615.51
7.1.220.0040.00815.68
7.1.210.0060.00615.59
7.1.200.0000.01315.59
7.1.190.0050.00815.68
7.1.180.0100.00015.71
7.1.170.0070.00315.75
7.1.160.0090.00615.55
7.1.150.0080.00415.88
7.1.140.0100.00315.66
7.1.130.0030.00815.87
7.1.120.0040.01115.63
7.1.110.0090.00615.91
7.1.100.0040.01016.98
7.1.90.0060.00615.74
7.1.80.0110.00315.93
7.1.70.0060.00716.46
7.1.60.0130.01325.39
7.1.50.0180.01025.18
7.1.40.0360.01225.01
7.1.30.0190.01525.17
7.1.20.0200.01225.14
7.1.10.0090.00816.10
7.1.00.0120.00616.15
7.0.330.0100.00315.48
7.0.320.0070.00715.34
7.0.310.0070.00715.34
7.0.300.0060.00315.43
7.0.290.0060.00615.38
7.0.280.0040.00815.40
7.0.270.0040.00815.28
7.0.260.0030.01015.38
7.0.250.0100.00315.44
7.0.240.0070.00315.47
7.0.230.0060.00615.26
7.0.220.0060.00615.54
7.0.210.0040.00415.15
7.0.200.0090.00516.01
7.0.190.0080.00816.09
7.0.180.0010.01315.84
7.0.170.0020.01215.79
7.0.160.0040.00915.69
7.0.150.0080.00815.62
7.0.140.0080.00815.80
7.0.130.0010.01116.09
7.0.120.0100.00716.00
7.0.110.0220.01215.01
7.0.100.0220.01214.97
7.0.90.0060.01215.94
7.0.80.0070.00915.90
7.0.70.0040.00915.77
7.0.60.0060.01115.88
7.0.50.0040.01115.90
7.0.40.0100.00514.89
7.0.30.0050.00914.89
7.0.20.0070.00714.87
7.0.10.0100.00714.96
7.0.00.0070.00814.77
5.6.400.0030.00914.25
5.6.390.0070.00714.43
5.6.380.0090.00614.30
5.6.370.0090.00614.36
5.6.360.0000.01114.21
5.6.350.0060.00914.39
5.6.340.0100.00614.13
5.6.330.0030.01014.65
5.6.320.0070.00714.36
5.6.310.0000.01113.99
5.6.300.0150.00014.71
5.6.290.0080.00614.48
5.6.280.0040.01114.11
5.6.270.0100.00314.48
5.6.260.0030.01014.45
5.6.250.0040.00714.57
5.6.240.0030.01014.13
5.6.230.0030.00914.64
5.6.220.0000.01514.06
5.6.210.0100.00714.16
5.6.200.0040.00714.29
5.6.190.0080.00014.66
5.6.180.0070.00714.13
5.6.170.0050.00314.29
5.6.160.0060.00914.39
5.6.150.0000.01414.33
5.6.140.0030.01014.29
5.6.130.0040.01214.17
5.6.120.0030.00914.24
5.6.110.0000.01514.23
5.6.100.0040.01114.27
5.6.90.0100.00314.39
5.6.80.0130.00014.30
5.6.70.0030.01314.17
5.6.60.0040.01114.32
5.6.50.0080.00314.32
5.6.40.0030.00614.13
5.6.30.0060.00914.34
5.6.20.0100.00314.15
5.6.10.0110.00414.16
5.6.00.0030.01014.13

preferences:
33.9 ms | 400 KiB | 5 Q