3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $foo; private $lazyLoad; public function saySomething() { return 'Saying ' . $this->foo; } private function __construct() { } public static function new() : self { $instance = new self(); $instance->foo = 'something'; return $instance; } public static function newLazy() : self { $instance = new self(); $instance->lazyLoad = function () use ($instance) { $instance->foo = 'something lazy'; }; unset($instance->foo); return $instance; } public function __get($name) { ($this->lazyLoad)(); return $this->foo; } } $foo = Foo::new(); var_dump($foo->saySomething()); $lazyFoo = Foo::newLazy(); var_dump($lazyFoo->saySomething());

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.4.120.0080.00520.47
8.4.110.0100.00818.84
8.4.100.0110.01019.00
8.4.90.0050.00424.21
8.4.80.0070.00419.06
8.4.70.0090.00619.07
8.4.60.0130.00918.70
8.4.50.0110.00920.38
8.4.40.0130.00719.39
8.4.30.0130.00720.42
8.4.20.0170.00417.63
8.4.10.0140.00719.48
8.3.250.0130.00519.07
8.3.240.0100.00916.53
8.3.230.0100.00916.45
8.3.220.0120.00618.86
8.3.210.0090.01116.39
8.3.200.0050.00416.90
8.3.190.0060.00316.90
8.3.180.0110.00918.77
8.3.170.0070.01118.85
8.3.160.0110.00719.10
8.3.150.0150.00417.06
8.3.140.0090.00916.85
8.3.130.0050.00516.51
8.3.120.0000.01119.12
8.3.110.0150.00420.94
8.3.100.0060.00318.71
8.3.90.0110.00418.45
8.3.80.0040.00419.36
8.3.70.0140.00716.50
8.3.60.0090.00618.45
8.3.50.0090.00716.65
8.3.40.0120.00318.61
8.3.30.0040.01118.76
8.3.20.0060.00321.77
8.3.10.0070.00021.70
8.3.00.0080.00017.80
8.2.290.0090.00218.86
8.2.280.0050.01518.66
8.2.270.0150.00317.37
8.2.260.0070.00718.19
8.2.250.0070.01718.36
8.2.240.0090.00016.51
8.2.230.0000.01322.58
8.2.220.0040.00424.06
8.2.210.0140.00326.77
8.2.200.0100.00016.88
8.2.190.0090.00916.63
8.2.180.0080.00818.54
8.2.170.0070.00722.96
8.2.160.0120.00321.92
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0080.00020.47
8.2.120.0040.00426.35
8.2.110.0100.00022.24
8.2.100.0060.00617.78
8.2.90.0000.00819.26
8.2.80.0080.00017.97
8.2.70.0030.00517.75
8.2.60.0040.00418.04
8.2.50.0030.00618.10
8.2.40.0040.00420.42
8.2.30.0050.00319.21
8.2.20.0030.00617.95
8.2.10.0000.00717.95
8.2.00.0030.00518.13
8.1.330.0090.00918.75
8.1.320.0140.00616.18
8.1.310.0090.00918.45
8.1.300.0100.00718.59
8.1.290.0040.00718.88
8.1.280.0100.01025.92
8.1.270.0120.00423.96
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00322.19
8.1.230.0080.00419.15
8.1.220.0040.00417.74
8.1.210.0060.00318.77
8.1.200.0100.00017.35
8.1.190.0030.00517.36
8.1.180.0060.00318.10
8.1.170.0030.00518.43
8.1.160.0070.00018.86
8.1.150.0030.00520.07
8.1.140.0000.00819.61
8.1.130.0070.00019.25
8.1.120.0100.00017.48
8.1.110.0040.00417.45
8.1.100.0000.00717.53
8.1.90.0070.00017.39
8.1.80.0040.00417.52
8.1.70.0030.00317.38
8.1.60.0000.00817.58
8.1.50.0000.00717.53
8.1.40.0040.00417.57
8.1.30.0000.00717.71
8.1.20.0040.00417.62
8.1.10.0040.00417.66
8.1.00.0090.00017.52
8.0.300.0040.00419.98
8.0.290.0040.00416.75
8.0.280.0070.00018.38
8.0.270.0070.00017.33
8.0.260.0030.00316.84
8.0.250.0060.00017.01
8.0.240.0090.00016.85
8.0.230.0030.00617.01
8.0.220.0030.00316.80
8.0.210.0030.00316.89
8.0.200.0050.00216.99
8.0.190.0060.00316.97
8.0.180.0040.00416.76
8.0.170.0030.00516.81
8.0.160.0040.00416.87
8.0.150.0030.00616.86
8.0.140.0030.00616.84
8.0.130.0030.00313.27
8.0.120.0000.00816.91
8.0.110.0000.00716.88
8.0.100.0020.00516.91
8.0.90.0000.00816.72
8.0.80.0090.00616.91
8.0.70.0080.00016.80
8.0.60.0050.00316.84
8.0.50.0070.00016.90
8.0.30.0060.01017.20
8.0.20.0120.01117.40
8.0.10.0000.00717.03
8.0.00.0090.01316.85
7.4.330.0060.00015.55
7.4.320.0000.00616.66
7.4.300.0030.00316.51
7.4.290.0030.00316.51
7.4.280.0080.00016.63
7.4.270.0000.00716.61
7.4.260.0000.00613.23
7.4.250.0070.00016.44
7.4.240.0050.00316.54
7.4.230.0040.00416.35
7.4.220.0070.01016.62
7.4.210.0070.01416.69
7.4.200.0030.00316.57
7.4.160.0020.01516.67
7.4.150.0110.00817.40
7.4.140.0130.00617.86
7.4.130.0210.00316.41
7.4.120.0100.01316.54
7.4.110.0140.00316.47
7.4.100.0170.00516.37
7.4.90.0040.01416.40
7.4.80.0100.00719.39
7.4.70.0140.00616.35
7.4.60.0090.00616.52
7.4.50.0000.01716.58
7.4.40.0060.01216.49
7.4.30.0060.01116.51
7.4.00.0060.00614.93
7.3.330.0020.00213.27
7.3.320.0000.00513.30
7.3.310.0000.00716.14
7.3.300.0050.00216.20
7.3.290.0080.00916.30
7.3.280.0080.00916.29
7.3.270.0110.00517.40
7.3.260.0120.00916.55
7.3.250.0060.01516.49
7.3.240.0130.00516.41
7.3.230.0070.01416.32
7.3.210.0090.00916.63
7.3.200.0030.01316.36
7.3.190.0080.00816.63
7.3.180.0030.01416.57
7.3.170.0060.01016.57
7.3.160.0160.00616.30
7.2.330.0070.01816.86
7.2.320.0090.00916.50
7.2.310.0090.00616.63
7.2.300.0180.01816.78
7.2.290.0100.01016.39
7.2.60.0080.00317.00
7.1.200.0040.00815.54
7.1.70.0060.00316.93
7.1.60.0470.01033.32
7.1.50.0430.01332.95
7.1.40.0800.00732.46
7.1.30.0670.02732.63
7.1.20.0630.01032.70
7.1.10.0430.01014.49
7.1.00.0470.01314.79
7.0.200.0330.00314.97
7.0.190.0300.01314.96
7.0.180.0330.00714.41
7.0.170.0330.01014.32
7.0.160.0300.01314.42
7.0.150.0570.01314.29
7.0.140.0470.01314.41
7.0.130.0400.01314.62
7.0.120.0500.00314.73
7.0.110.0530.01014.65
7.0.100.0500.01714.57
7.0.90.0500.01314.54
7.0.80.0430.01014.46
7.0.70.0430.00714.44
7.0.60.0430.01714.39
7.0.50.1700.00314.46
7.0.40.0600.01314.59
7.0.30.0670.01014.75
7.0.20.0400.01314.73
7.0.10.0630.01014.63
7.0.00.0330.01314.29

preferences:
33.11 ms | 403 KiB | 5 Q