3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Hi { protected $message = 'Hello'; public function setMessage(string $message) { $this->message = $message; } public function sayHello() : Hi { var_dump($this->message); return $this; } } class WrapperCat extends Hi { private $realThing; public function __construct(Hi $realThing) // should be a named constructor instead { $this->realThing = $realThing; } public function sayHello() : Hi { var_dump('WrapperCat Meow! '); return $this->realThing->sayHello(); } } class CopyCat extends Hi { public function __construct(Hi $realThing) // should be a named constructor instead { $this->message = & $realThing->message; } public function sayHello() : Hi { var_dump('CopyCat Meow! ' . $this->message); return $this; } } $hi = new Hi; $wrapperCat = new WrapperCat($hi); $copyCat = new CopyCat($hi); $hi->setMessage('Hello'); var_dump(Hi::class); $hi->sayHello()->sayHello(); var_dump(WrapperCat::class); $wrapperCat->sayHello()->sayHello(); var_dump(CopyCat::class); $copyCat->sayHello()->sayHello(); $hi->setMessage('Hi'); var_dump(Hi::class); $hi->sayHello()->sayHello(); var_dump(WrapperCat::class); $wrapperCat->sayHello()->sayHello(); var_dump(CopyCat::class); $copyCat->sayHello()->sayHello();

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.5.30.0100.00817.52
8.5.20.0100.00620.02
8.5.10.0130.00620.02
8.5.00.0140.00820.21
8.4.180.0120.01019.64
8.4.170.0090.01223.80
8.4.160.0120.01123.05
8.4.150.0060.00616.86
8.4.140.0140.00817.59
8.4.130.0100.00317.70
8.4.120.0140.00620.44
8.4.110.0140.00922.42
8.4.100.0130.00817.56
8.4.90.0110.00918.68
8.4.80.0130.00719.38
8.4.70.0080.00817.85
8.4.60.0110.01018.91
8.4.50.0160.00618.82
8.4.40.0130.00620.55
8.4.30.0130.00717.55
8.4.20.0100.01017.69
8.4.10.0030.00617.69
8.3.300.0120.00819.00
8.3.290.0080.01220.92
8.3.280.0130.00818.37
8.3.270.0130.00616.73
8.3.260.0100.01016.77
8.3.250.0110.00718.73
8.3.240.0090.01116.83
8.3.230.0110.00816.44
8.3.220.0090.00818.87
8.3.210.0030.00516.64
8.3.200.0060.00316.46
8.3.190.0030.00517.02
8.3.180.0090.01116.45
8.3.170.0150.00420.56
8.3.160.0190.00017.36
8.3.150.0100.01018.93
8.3.140.0130.00616.92
8.3.130.0040.00416.78
8.3.120.0000.00820.91
8.3.110.0000.00816.51
8.3.100.0080.00316.79
8.3.90.0080.00026.77
8.3.80.0030.00616.75
8.3.70.0150.00716.88
8.3.60.0180.00318.31
8.3.50.0100.00921.99
8.3.40.0150.00618.82
8.3.30.0140.00018.84
8.3.20.0070.00320.34
8.3.10.0040.01121.90
8.3.00.0080.00020.84
8.2.300.0140.00620.39
8.2.290.0120.00820.58
8.2.280.0050.00418.43
8.2.270.0060.00918.87
8.2.260.0120.00618.50
8.2.250.0040.00416.70
8.2.240.0000.00918.23
8.2.230.0050.00320.94
8.2.220.0030.00624.06
8.2.210.0040.00426.77
8.2.200.0040.00418.17
8.2.190.0110.00416.88
8.2.180.0110.00425.92
8.2.170.0160.00318.84
8.2.160.0100.00322.96
8.2.150.0070.00025.66
8.2.140.0090.00924.66
8.2.130.0090.00026.16
8.2.120.0080.00021.07
8.2.110.0030.00619.37
8.2.100.0060.00617.93
8.2.90.0040.00419.05
8.2.80.0060.00317.97
8.2.70.0030.00617.63
8.2.60.0080.00018.05
8.2.50.0080.00018.10
8.2.40.0030.00620.59
8.2.30.0040.00420.82
8.2.20.0050.00317.67
8.2.10.0040.00418.22
8.2.00.0050.00218.03
8.1.340.0130.00817.66
8.1.330.0120.00721.91
8.1.320.0130.00616.40
8.1.310.0070.00718.71
8.1.300.0040.00418.62
8.1.290.0000.00930.84
8.1.280.0080.00825.92
8.1.270.0040.00423.92
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0040.00419.06
8.1.230.0000.01119.11
8.1.220.0040.00417.79
8.1.210.0050.00318.77
8.1.200.0070.00317.48
8.1.190.0050.00517.35
8.1.180.0000.00818.10
8.1.170.0070.00318.69
8.1.160.0000.00720.82
8.1.150.0000.00818.88
8.1.140.0030.00519.57
8.1.130.0040.00417.69
8.1.120.0000.00717.46
8.1.110.0050.00317.48
8.1.100.0000.00817.49
8.1.90.0040.00417.46
8.1.80.0040.00417.34
8.1.70.0000.00717.39
8.1.60.0050.00317.61
8.1.50.0050.00317.46
8.1.40.0060.00317.54
8.1.30.0030.00617.59
8.1.20.0060.00317.64
8.1.10.0040.00417.59
8.1.00.0000.00817.58
8.0.300.0000.00718.77
8.0.290.0040.00416.88
8.0.280.0030.00318.41
8.0.270.0080.00017.23
8.0.260.0080.00017.18
8.0.250.0030.00417.03
8.0.240.0040.00417.11
8.0.230.0070.00017.00
8.0.220.0000.00716.88
8.0.210.0050.00216.90
8.0.200.0000.00716.95
8.0.190.0040.00416.91
8.0.180.0000.00817.07
8.0.170.0040.00416.92
8.0.160.0040.00416.95
8.0.150.0030.00517.04
8.0.140.0040.00416.94
8.0.130.0000.00613.32
8.0.120.0050.00316.89
8.0.110.0000.00716.91
8.0.100.0000.00716.85
8.0.90.0050.00216.97
8.0.80.0030.01316.91
8.0.70.0040.00416.83
8.0.60.0040.00416.81
8.0.50.0050.00216.78
8.0.30.0080.01217.04
8.0.20.0110.00917.40
8.0.10.0050.00217.06
8.0.00.0070.01116.83
7.4.330.0020.00215.08
7.4.320.0070.00016.60
7.4.300.0040.00416.65
7.4.290.0070.00016.57
7.4.280.0000.00716.57
7.4.270.0070.00016.61
7.4.260.0040.00416.64
7.4.250.0000.00716.42
7.4.240.0000.00716.58
7.4.230.0030.00316.55
7.4.220.0030.01316.60
7.4.210.0040.01116.61
7.4.200.0030.00316.46
7.4.160.0030.01316.47
7.4.150.0060.01317.40
7.4.140.0020.01617.86
7.4.130.0100.01016.48
7.4.120.0060.01016.43
7.4.110.0130.00316.66
7.4.100.0100.01016.66
7.4.90.0060.01116.52
7.4.80.0100.00719.39
7.4.70.0150.00316.47
7.4.60.0030.01316.70
7.4.50.0120.00616.46
7.4.40.0120.01116.70
7.4.30.0170.00616.54
7.4.00.0040.00814.98
7.3.330.0000.00513.31
7.3.320.0030.00313.18
7.3.310.0030.00316.16
7.3.300.0000.00716.26
7.3.290.0060.01116.34
7.3.280.0040.01316.30
7.3.270.0110.01117.40
7.3.260.0070.01116.50
7.3.250.0090.01016.31
7.3.240.0080.01416.41
7.3.230.0070.01016.58
7.3.210.0060.01216.45
7.3.200.0100.01316.39
7.3.190.0130.01016.47
7.3.180.0070.01016.50
7.3.170.0070.01016.19
7.3.160.0080.00816.30
7.3.120.0070.00715.00
7.3.110.0140.00415.01
7.3.100.0030.01314.98
7.3.90.0060.00615.00
7.3.80.0110.00715.01
7.3.70.0040.00414.84
7.3.60.0140.00314.58
7.3.50.0070.00714.69
7.3.40.0160.00014.78
7.3.30.0030.01314.83
7.3.20.0090.00316.73
7.3.10.0000.01416.56
7.3.00.0060.00816.60
7.2.330.0150.00416.86
7.2.320.0100.01016.45
7.2.310.0080.01216.59
7.2.300.0070.01016.82
7.2.290.0120.00416.78
7.2.250.0070.01315.00
7.2.240.0030.01715.00
7.2.230.0070.01014.62
7.2.220.0080.00615.00
7.2.210.0000.01015.04
7.2.200.0060.01014.89
7.2.190.0040.01114.97
7.2.180.0030.00614.63
7.2.170.0110.00714.79
7.2.130.0140.00516.72
7.2.120.0050.01016.87
7.2.110.0050.00916.89
7.2.100.0070.00616.89
7.2.90.0080.00816.93
7.2.80.0000.01316.82
7.2.70.0020.01217.00
7.2.60.0060.00816.82
7.2.50.0070.00916.85
7.2.40.0120.00316.79
7.2.30.0080.00517.10
7.2.20.0070.00416.75
7.2.10.0030.01116.94
7.2.00.0050.00717.54
7.1.330.0060.01015.56
7.1.320.0040.01415.74
7.1.310.0000.01415.71
7.1.300.0090.00015.72
7.1.290.0110.00415.88
7.1.280.0100.00315.57
7.1.270.0030.01015.84
7.1.260.0030.01015.97
7.1.250.0090.01115.75
7.1.240.0130.00515.46
7.1.230.0120.00415.79
7.1.220.0090.00315.55
7.1.210.0100.00715.67
7.1.200.0100.00515.71
7.1.190.0070.00715.88
7.1.180.0080.00015.75
7.1.170.0140.00315.73
7.1.160.0080.00815.88
7.1.150.0100.00715.79
7.1.140.0050.00515.84
7.1.130.0080.00615.64
7.1.120.0040.01115.78
7.1.110.0070.00715.92
7.1.100.0030.01017.06
7.1.90.0100.00715.46
7.1.80.0040.00815.53
7.1.70.0030.00816.32
7.1.60.0110.00818.17
7.1.50.0090.00516.30
7.1.40.0090.00015.72
7.1.30.0080.00415.76
7.1.20.0080.00015.76
7.1.10.0060.00615.91
7.1.00.0050.04218.98
7.0.330.0070.01215.31
7.0.320.0000.01415.34
7.0.310.0040.01115.33
7.0.300.0120.00315.23
7.0.290.0030.01015.05
7.0.280.0100.00315.17
7.0.270.0060.00315.41
7.0.260.0100.00315.50
7.0.250.0000.01215.45
7.0.240.0100.00015.48
7.0.230.0030.01015.54
7.0.220.0140.00315.53
7.0.210.0100.01015.20
7.0.200.0050.01015.55
7.0.190.0090.00615.15
7.0.180.0030.01415.39
7.0.170.0090.00615.53
7.0.160.0130.00015.39
7.0.150.0030.01015.19
7.0.140.0030.00615.27
7.0.130.0000.01015.41
7.0.120.0100.00315.47
7.0.110.0060.00315.39
7.0.100.0070.00315.36
7.0.90.0000.01014.98
7.0.80.0040.00415.10
7.0.70.0070.00715.35
7.0.60.0080.03718.55
7.0.50.0070.04016.63
7.0.40.0130.03516.75
7.0.30.0290.03516.75
7.0.20.0290.04416.67
7.0.10.0270.03416.69
7.0.00.0160.03416.95
5.6.380.0000.01013.96
5.6.370.0030.01013.95
5.6.360.0090.00614.39
5.6.350.0000.00914.23
5.6.340.0000.01213.76
5.6.330.0040.00814.39
5.6.320.0060.00614.33
5.6.310.0130.00014.09
5.6.300.0000.00713.96
5.6.290.0060.00614.43
5.6.280.0080.03617.46
5.6.270.0030.01214.15
5.6.260.0000.01013.76
5.6.250.0060.00613.93
5.6.240.0030.01313.97
5.6.230.0090.00613.98
5.6.220.0030.01013.97
5.6.210.0010.03617.38
5.6.200.0050.03516.12
5.6.190.0230.03317.30
5.6.180.0250.03917.35
5.6.170.0170.04017.18
5.6.160.0100.03517.20
5.6.150.0080.03717.11
5.6.140.0120.03417.31
5.6.130.0080.03617.00
5.6.120.0120.03317.25
5.6.110.0100.03617.11
5.6.100.0150.03817.19
5.6.90.0050.03717.21
5.6.80.0080.03216.86
5.6.70.0180.03716.90
5.6.60.0110.03916.92
5.6.50.0080.03416.71
5.6.40.0100.03516.77
5.6.30.0060.03916.94
5.6.20.0100.04216.82
5.6.10.0050.03916.85
5.6.00.0150.02716.92
5.5.380.0060.00010.90
5.5.370.0040.00410.90
5.5.360.0060.00310.90
5.5.350.0100.02215.61
5.5.340.0000.03114.44
5.5.330.0270.04015.59
5.5.320.0230.03515.74
5.5.310.0200.02915.65
5.5.300.0170.02715.55
5.5.290.0080.03515.59
5.5.280.0050.04715.55
5.5.270.0090.03115.50
5.5.260.0120.03615.45
5.5.250.0100.03015.37
5.5.240.0060.03615.24
5.5.230.0050.04515.24
5.5.220.0100.03015.27
5.5.210.0070.03315.22
5.5.200.0050.03515.21
5.5.190.0080.03215.24
5.5.180.0100.03015.21
5.5.170.0040.00410.90
5.5.160.0090.03015.24
5.5.150.0130.03615.20
5.5.140.0120.02815.18
5.5.130.0090.02815.18
5.5.120.0070.03015.23
5.5.110.0060.03315.17
5.5.100.0080.03115.18
5.5.90.0030.03515.19
5.5.80.0090.03115.18
5.5.70.0080.03315.15
5.5.60.0180.02615.15
5.5.50.0080.02815.13
5.5.40.0100.02915.25
5.5.30.0150.02515.20
5.5.20.0100.03015.15
5.5.10.0050.03615.13
5.5.00.0130.04015.18

preferences:
91.79 ms | 2221 KiB | 5 Q